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 |
|
sbaroux
Starting Member
9 Posts |
Posted - 2005-12-13 : 11:34:43
|
| Hello, I run these 2 queries and I receive a different result.The only difference is that the 2nd query contains a DISTINCT on the first sub query ... but it's not supposed to play any role as I have a global DISTINCT at the top of the query.Where Am I wrong???select count(distinct a.email) from(selecta.emailfrom cust_analysis_FY06Q1 a,(select distinct email from order_FY06Q1) bwhere a.email = b.email ) a,(select distinct email from store_list where global_optin = 1 andemail_bounce is null) cwhere a.email = c.email;select count(distinct a.email) from(selectDISTINCT a.emailfrom cust_analysis_FY06Q1 a,(select distinct email from order_FY06Q1) bwhere a.email = b.email ) a,(select distinct email from store_list where global_optin = 1 and email_bounce is null) cwhere a.email = c.email;For info, when I remove the condition "where global_optin = 1 and email_bounce is null" on the 2 queries, the result is the same for the 2 queries ... I'm lostCould you help me?ThanksStephanie |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-14 : 00:37:12
|
| Distinct will give you expected result only if rows are duplicatedMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|