[thelist] [mysql] join

kris burford kris at midtempo.net
Fri Jan 23 12:39:50 CST 2004

>SELECT table_two.name, some_other_stuff
>FROM table_two
>INNER JOIN table_one
>ON table_one.id_one = table_two.id
>WHERE [x]
>SELECT table_two.name, some_other_stuff
>FROM table_two
>INNER JOIN table_one
>ON table_one.id_two = table_two.id
>WHERE [x]

okay, with table.one containing two rows (a, b) that returns*
row1 : a.id_one.name, a.id.some_other_stuff
row2 : b.id_one.name, b.id.some_other_stuff
row3 : a.id_two.name, a.id.some_other_stuff
row4 : b.id_two.name, b.id.some_other_stuff

*or in other terms, with colour and size as the two id references, plus 
quantity as the "other stuff":
row1 green 5
row2 orange 10
row3 large 5
row4 small 10

whereas what i was hoping for was
row1 : a.id_one.name, a.id_two.name, a.id.some_other_stuff
row2 : b.id_one.name, b.id_two.name, b.id.some_other_stuff

any ideas??



More information about the thelist mailing list