|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Please help with a simple many-to-many join query
Hi,
I have two tables (a and b) with a many-to-many relationship defined by a 'link_table'. Given an id for table b (33 in the example below), I want to use a join to retrieve the corresponding records in table a. I've tried the query below (which looks right to me), but i'm not getting any records returned (using MySQL 4.0.18 and InnoDB). Pleeease help. Here's the query: SELECT a.fld1, a.fld2, a.fld3 FROM long_tablename_a AS a JOIN link_table ON link_table.a_id='33' AND link_table.a_id = a.id WHERE 1 = 1; Thanks. |
|
#2
|
|||
|
|||
|
Problem sovled
My problem wasn't the query...it was the fact that the key on table a was a varchar, not an int...
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Please help with a simple many-to-many join query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|