SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: joining tables
-
May 31, 2001, 21:42 #1
- Join Date
- May 2000
- Location
- Rocky Mount, NC
- Posts
- 74
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
joining tables
Okay. I need to join tables to make this work. Lets see. I have a database the following tables:
TABLE "SONGS"
|songID
|songName
|songArtist
|songRequest
TABLE "STATIONS"
|stationID
|stationName
|stationCity
|stationState
|stationSite
then I have the channel table to join them:
TABLE "CHANNEL"
|songID
|stationID
On my site I will need to list all the stations listed with any given song. Say I need the song Butterfly that was heard on the stations KISS FM, K98, and Star94, how would I get those pulled from the database?Stuart Briscar Consulting - Free Website Consulting
-
May 31, 2001, 23:40 #2
- Join Date
- Jul 2000
- Location
- Misty Mountain
- Posts
- 125
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:SELECT stationName,stationCity,stationState,stationSite FROM STATIONS, SONGS, CHANNEL WHERE CHANNEL.songID = SONGS.songID AND CHANNEL.stationID = STATIONS.stationID AND SONGS.songName = 'Butterfly'
-
Jun 1, 2001, 01:59 #3
- Join Date
- Feb 2001
- Location
- Shanghai, China
- Posts
- 214
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hey what I always wanted to know, does it make any difference between what "oodie" says and this here using a LEFT JOIN:
PHP Code:SELECT stationName,stationCity,stationState,stationSite
FROM STATIONS LEFT JOIN SONGS ON STATIONS.stationID = SONGS.songID WHERE SONGS.songName = 'Butterfly';
Bookmarks