Many to Many query
|
Original Message
|
Name: ShaqDiesel
Date: July 3, 2008 at 21:24:51 Pacific
Subject: Many to Many queryOS: winXPCPU/Ram: Amd64/1GbModel/Manufacturer: custom |
Comment: I have a many to many relationship of titles and authors. I have a table of authors, another for titles, and a junction table. For a given title, how would I extract ALL the authors? I don't want multiple rows for the same title.
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: dotnet_ohio
Date: July 16, 2008 at 19:38:05 Pacific
Subject: Many to Many query |
Reply: (edit)It depends on your database. I am not 100% sure on MySQL, but in Access or SQL 200x you can use a left join / right join command in the from clause. The left join (and there are forums - just search google for left join / right join) that will tell you the exact details. Also, a trick I used to do was link the tables in Access. Then in the actually do the query with the design view in access. After you make the join between the tables, just select all from table titles to table authors. If you click over to the SQL view, it will actually create the query for you. Note, you can't just cut and paste this as is, you will have to format it for whatever language you have. Also, I'm not sure if this will work with MySQL. http://www.dotnetohio.com
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: