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
 General SQL Server Forums
 New to SQL Server Programming
 write this query some other manner.

Author  Topic 

rajadadi
Starting Member

30 Posts

Posted - 2010-05-28 : 06:42:12
i want this query some other manner with same result

Select Remedy_Login_ID,Person_ID,Permission_Group,Permission_Group_ID,Permission_Group_Type,Company from CTM_People_Permission_Groups

where Person_ID not in(select Person_ID from CTM_People_Permission_Groups where

Permission_Group_Type = 2 and Company like 'CGI Core Services'

and Permission_Group_ID = '1000000785')and Permission_Group_Type = 2 and Company like 'CGI Core Services' order by Remedy_Login_ID

rajesh

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-28 : 06:51:07
[code]Select
Remedy_Login_ID,
Person_ID,
Permission_Group,
Permission_Group_ID,
Permission_Group_Type,
Company
from CTM_People_Permission_Groups t1
where not exists (select * from CTM_People_Permission_Groups t2
where t1.Person_ID = t2.Person_ID
and t2.Permission_Group_Type = 2
and t2.Company = 'CGI Core Services' -- like without joker is senseless
and t2.Permission_Group_ID = '1000000785')
and Permission_Group_Type = 2
and Company = 'CGI Core Services'
order by Remedy_Login_ID
[/code]


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2010-05-28 : 06:53:07
try this too

Select
t1.Remedy_Login_ID,
t1.Person_ID,
t1.Permission_Group,
t1.Permission_Group_ID,
t1.Permission_Group_Type,
t1.Company
from CTM_People_Permission_Groups t1
LEFT JOIN CTM_People_Permission_Groups t2 on t1.Person_ID = t2.Person_ID
and t2.Permission_Group_Type = 2
and t2.Company = 'CGI Core Services' -- like without joker is senseless
and t2.Permission_Group_ID = '1000000785'
WHERE t1.Permission_Group_Type = 2
and t1.Company = 'CGI Core Services'
and t2.person_id is null
order by t1.Remedy_Login_ID
Go to Top of Page

rajadadi
Starting Member

30 Posts

Posted - 2010-05-28 : 07:22:32
Thank you its working

rajesh
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-05-28 : 07:50:53
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -