| Index
» Projekty
» phpMyEdit
» Fórum
» Join with one-to-many relationships |
 |
KarelB
Založený: 01.06.2007
Príspevky: 24
Zaslal: 2009-02-11 14:46
Návrat hore
Odpovedať s citátom
|
All,
I have two tables that have a one-to-many relationship.
I joined them using the following construct:
| Kód: |
$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
Založený: 26.01.2010
Príspevky: 10
Zaslal: 2010-07-26 15:39
Návrat hore
Odpovedať s citátom
|
did u ever find a solution to this?
|
KarelB
Založený: 01.06.2007
Príspevky: 24
Zaslal: 2010-07-26 16:44
Návrat hore
Odpovedať s citátom
|
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
Založený: 26.01.2010
Príspevky: 10
Zaslal: 2010-07-26 17:43
Návrat hore
Odpovedať s citátom
|
i also started using mate. can you give me an example how you did it in mate?
|
KarelB
Založený: 01.06.2007
Príspevky: 24
Zaslal: 2010-07-26 19:30
Návrat hore
Odpovedať s citátom
|
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
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|