| Index
» Projects
» phpMyEdit
» Forum
» Join with one-to-many relationships |
 |
KarelB
Joined: 01 Jun 2007
Posts: 24
Posted: 2009-02-11 14:46
Back to top
Reply with quote
|
All,
I have two tables that have a one-to-many relationship.
I joined them using the following construct:
| Code: |
$opts['fdd']['dummy1'] = array(
'name' => 'Dossier Status',
'options' => 'L',
'maxlen' => 255,
'escape' => false,
'sort' => true,
'colattrs' =>'align="center"',
'nowrap' => true,
'values' => Array( // API for currently making a join in PME.
'table' => 'gd_dossier_history', // the table to which we're joining
'column' => 'id', // the key field in the joined table
'description' => 'dos_status', // the desired column in the joined table
'join' => '$main_table.wo_nr = $join_table.wo_nr AND $main_table.wo_nr!=0',
),
'sql' => 'PMEjoin2.dos_status'
);
|
This works fine but gives as many rows as there are relations. I like to limit my table to only one entry
based on a date in the join table.
In SQL i like to say:
.... ORDER BY $join_table.dos_logdate LIMIT 1
IS this possible.
Or any other tricks to only show one row?
Cheers
KArel
|
msavi
Joined: 26 Jan 2010
Posts: 10
Posted: 2010-07-26 15:39
Back to top
Reply with quote
|
did u ever find a solution to this?
|
KarelB
Joined: 01 Jun 2007
Posts: 24
Posted: 2010-07-26 16:44
Back to top
Reply with quote
|
I think I did not succeed in this quest.
But I can't remember as I now use a different table editor called MATE. (
www.mysqlajaxtableeditor.com)
Cheers
Karel
|
msavi
Joined: 26 Jan 2010
Posts: 10
Posted: 2010-07-26 17:43
Back to top
Reply with quote
|
i also started using mate. can you give me an example how you did it in mate?
|
KarelB
Joined: 01 Jun 2007
Posts: 24
Posted: 2010-07-26 19:30
Back to top
Reply with quote
|
I think this is not the place to discuss solutions in other software. I am more then willing to answer MATE questions in its own forum accessible from their website.
But the short answer is: you need a view or a temp table.
Cheers
Karel
|
|
Post new topic
Reply to topic
|
|
|
|