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 |
jgn1013
Starting Member
24 Posts |
Posted - 2009-02-17 : 16:39:11
|
table A---------region..idJ.......11J.......12 Z.......13Z.......14Z.......15table B---------id....title11....Accountant12....Artist12....Programmer13....Nurseselect id from tableA where region='J'loop through value 11,12select id,title from tableB where tableA.id = 11 or 12result11....Accountant12....Artist12....Programmernot really sure if looping is the way to go.TIA |
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2009-02-17 : 16:44:01
|
select b.ID, b.titlefrom tablea ainner join tableb b on a.region=b.idwhere a.region in(11,12)Mike"oh, that monkey is going to pay" |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-17 : 16:57:53
|
quote: Originally posted by mfemenel select b.ID, b.titlefrom tablea ainner join tableb b on a.id=b.idwhere a.region in(11,12)Mike"oh, that monkey is going to pay"
|
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2009-02-17 : 21:00:28
|
woops. Thanks sodeep.Mike"oh, that monkey is going to pay" |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-02-17 : 22:55:02
|
quote: Originally posted by sodeep
quote: Originally posted by mfemenel select b.ID, b.titlefrom tablea ainner join tableb b on a.id=b.idwhere a.region = 'j' in(11,12)Mike"oh, that monkey is going to pay"
|
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-17 : 23:03:35
|
quote: Originally posted by bklr
quote: Originally posted by sodeep
quote: Originally posted by mfemenel select b.ID, b.titlefrom tablea ainner join tableb b on a.id=b.idwhere a.id in (11,12) Mike"oh, that monkey is going to pay"
|
|
|
|
|
|
|
|