Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kurac
Starting Member
1 Post |
Posted - 2010-04-21 : 13:35:25
|
Hi there,I have to query a database for some data. The DB has two tables named 'track' and 'artist'.The 'track' table contains, amongst other things, a 'trackname' column and 'artistid' column. The 'artist' table contains 'artistname' and 'artistid' columns.I want a query to select every 'trackname' from 'track' and 'artistname' from 'artist' with the corresponding 'artistid'.Can you help me please?At the moment I'm thinking something likeSELECT trackname, artistname FROM track, artist WHERE track.artistid = artist.artistid But I'm not sure that's correct... |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-04-21 : 14:58:31
|
Did you try your query? It should work. Try this too.SELECT a.trackname, b.artistname , b.artistid FROM track ainner join artist b on a.artistid = b.artistid |
 |
|
|
|
|
|