Click here to Skip to main content
15,904,494 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two tables,

artist
A_id A_name
1 name 1
2 name 2
3 name 3

song
s_id AID s_name
1 1 name
2 1 name
3 3 name

my problem is how can i select artist names from artist table only used song table. I need to get result like this

A_id A_nam
1 name 1
3 name 3

Please help me..!!
Posted

1 solution

As per your question the answer is :

SQL
select distinct A.A_id,A.A_name from Artist A join Songs B on A.A_id=B.Aid


output :
A_id A_name
1 Name 1
3 Name 3
 
Share this answer
 
Comments
[no name] 24-Feb-15 6:27am    
If answer is correct then please mark this as answer.
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900