Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Help with SQL query Expand / Collapse
Author
Message
Posted Monday, July 22, 2013 7:02 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,867, Visits: 2,275
ChrisM@Work (7/22/2013)
SELECT op, SUM(CASE WHEN dupes > 1 THEN 1 ELSE 0 END) 
FROM (
SELECT op, imei, dupes = COUNT(*)
FROM #mastertab
GROUP BY op, imei
) d
GROUP BY op


can you please explain your query... I am not getting outer select statement... SUM(CASE WHEN dupes > 1 THEN 1 ELSE 0 END)



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1475996
Posted Monday, July 22, 2013 7:13 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, April 14, 2014 11:50 PM
Points: 1,867, Visits: 2,275
ChrisM@Work (7/22/2013)
SELECT op, SUM(CASE WHEN dupes > 1 THEN 1 ELSE 0 END) 
FROM (
SELECT op, imei, dupes = COUNT(*)
FROM #mastertab
GROUP BY op, imei
) d
GROUP BY op



thanks Chris....
got you query now



_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1476002
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse