This topic is locked

Master-Detail relationship with a secondary key

11/8/2007 1:10:13 PM
PHPRunner General questions
V
voicemagic author

I would like to display only detail records which match on two fields in the master instead of one.

I set up one field as a primary key.

How best can I identify a second field?

Sergey Kornilov admin 11/8/2007

The current version of PHPRunner do not allow you to use more than one field to define Master-Details relationship.

V
voicemagic author 11/8/2007

OK, I have two tables:
Employee Table

Employee Dept

Employee ID

Employee Name

Etc...
Awards Table

Employee Dept

Employee ID

Award

Date of Award

Etc...
I want to browse the employee table, select an employee & then display a list of that employee's awards.

I need to match on both Employee ID & Employee Dept to retrieve the correct records.
Is there anyway I can achieve the same result?

Would changing the query help in any way?

J
JColtro 11/9/2007

I had the same problem and I solved through the creation of a VIEW in the database. Catch the two fields and create an only one to use in PHPRUNNER. See the example that I created: "..... select concat (`a`. ` COMPANY `, `a`. ` BRANCH `) AS ` ID `,..... ". That solves the problem, except for entrance of new registrations or alteration of those already existent.

V
voicemagic author 11/9/2007

I'm not sure I follow.

Do you mean create a "custom" view? Of both the master & detail tables?

Do I insert the "select" in the SQL query?

Sergey Kornilov admin 11/9/2007

This view needs to be created in the database itself.

V
voicemagic author 11/9/2007

This view needs to be created in the database itself.


Thanks, I'll look at that.

V
voicemagic author 11/9/2007

MySQL server does not support this type of view.

Does anyone have another possible solution to offer? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23199&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

Sergey Kornilov admin 11/9/2007

MySQL 5.0 does.
We'll have this feature in one of the following versions.