Re: help on mulit query
| From: | Miles Thompson | Date: | Mon, 07 Jan 2002 01:21:50 +0000 |
| Subject: | Re: help on mulit query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15468@lists.php.net to get a copy of this message | ||
Your query looks fine, except that it should be xp_sings.songs_id. What you are trying to resolve is a many to many relationship where many artists can sing the same song, hence you have created the table xp_sings. This is also known as a pivot table.
What problem are you having?
Have you echoed your SQL statement? Tried it at the console?
Miles Thompson
At 01:40 PM 1/7/2002 +1300, Barry Rumsey wrote:
Hi I have three tables set out below: xp_artist: artist_id , artist _name xp_sings: artist_id , songs_id xp_songs: songs_id , song_name , lyrics I can not figure out how to query and return the results for a query like: "select song_name FROM xp_artist,xp_sings,xp_songs WHERE xp_artist.artist_id = xp_sings.artist_id AND xp_sings.song_id = xp_songs.songs_id AND artist_name LIKE 'b%'";