Jump to content

join tables problem


janim

Recommended Posts

hi guys

i have trouble in joining tables together

lets say i have two tables : singers and songs .

********

singers table :

id  name

1  eminem

2  akon

3  shaggy

 

********

songs table:

id  song

1  smack that

2  sexy

3  lose your self

4  till i collapse

5  lonely

 

etc....

 

so how can i join those tables ????

every singer has a lot of songs and every song has a lot of singers too

let's take example here

 

smack that by eminem  and akon so i can't put another row in the songs table for the singer name

please help this is gonna kill me

 

 

Link to comment
Share on other sites

You either need a singer field in the songlist or a song field in the singer list.  Then you can join them by ID.  Singer list in the songlist would probably be better.

 

Or a third table that has song and singers in the fields.

Link to comment
Share on other sites

As Revraz has said you need to add further details

 

singers table :

id  name

1  eminem

2  akon

3  shaggy

 

********

songs table:

id  song    name

1  smack that  eminem

2  smack that  akon

3  sexy

4  lose your self

5  till i collapse

6  lonely

 

 

select * from singers a, songs b

where name a = name b

 

etc....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.