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 |
|
bcanonica
Starting Member
35 Posts |
Posted - 2009-03-20 : 14:48:50
|
| I have a table called tblLanguageLocation which has two columns foreign keys LanguageID and LocationID from two tables tblLanguage and tblLocation.What I need to do is find the Locations that don't have a specific languageID of 1 and then add it. Any ideas or help? |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-03-20 : 14:59:24
|
Try the SELECT first - if it looks good then include the INSERT as well:insert tblLanguageLocation (LanguageID ,locationid )select 1 as LanguageID ,l.locationid from tblLocation lleft join tblLanguageLocation ll on ll.locationid = l.locationid and ll.languageid = 1where ll.locationid is null Be One with the OptimizerTG |
 |
|
|
bcanonica
Starting Member
35 Posts |
Posted - 2009-03-20 : 15:21:37
|
| Thanks that is exactly what I was looking for I appreciate it. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-03-20 : 15:29:23
|
You're welcome!(i'm trying Visakh's politeness trick to increase my post count )Be One with the OptimizerTG |
 |
|
|
|
|
|