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 |
yadhu_cse
Constraint Violating Yak Guru
252 Posts |
Posted - 2011-02-28 : 23:42:57
|
Hi,i am writing common table expression to retrive data from table likeWith CTE AS(select *from dbo.EnquiryDetails where webstatusflag=0),CTE1 as (select *from dbo.EnquiryDetails where webstatusflag=1)NOw i wnat to display cte data which should not present in cte1i have matching filed in cte and cte1 that is email id and registration no.how to get the result can any ane tel. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-01 : 01:46:01
|
[code]select *from cte cwhere not exists ( select * from cte1 x where x.emailid = c.emailid and x.registrationno = c.registrationno )[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
yadhu_cse
Constraint Violating Yak Guru
252 Posts |
Posted - 2011-03-01 : 02:28:35
|
Thanks |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-03-01 : 02:37:53
|
sorry, the condition should be "NOT EXISTS" KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|