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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Is Not Parameter

Author  Topic 

mlawton40
Starting Member

15 Posts

Posted - 2007-04-24 : 11:39:14
Hi, I have the following tables:

AR
ARId
MSL_Shortname

XRef_AR_User
ARId
UserName

I am trying to return all MSL_Shortname's from AR where the username parameter IS NOT associated with an ARId in XRef_AR_User.

Any ideas? I keep getting multiple values of the same shortname and not enough shortname's can't seem to get the sql to return all the correct results.

Any help would be great.
Thanks, Mark

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-24 : 11:43:26
[code]
select MSL_Shortname
from AR a left join XRef_AR_User b
on a.ARId = b.ARId
where b.ARId is null
[/code]


KH

Go to Top of Page

cvraghu
Posting Yak Master

187 Posts

Posted - 2007-04-24 : 13:55:58
quote:
Originally posted by mlawton40

I am trying to return all MSL_Shortname's from AR where the username parameter IS NOT associated with an ARId in XRef_AR_User.




I'm not able to understand this statement. Please provide some sample data and expected output.

Do you want to get all users in AR who are not available in XRef_AR_User?
Go to Top of Page
   

- Advertisement -