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

qry options Expand / Collapse
Author
Message
Posted Tuesday, June 11, 2013 10:56 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, August 18, 2014 10:18 AM
Points: 997, Visits: 2,974
I want to do this.

select count(*) from
(
select col1,col2,......col18 from REVemployee.tbemp
group by col1,col2,......col18 HAVING COUNT(*)>1
)a


is there a better way of doing the same for better proformance?
Post #1462268
Posted Wednesday, June 12, 2013 3:00 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, August 18, 2014 8:36 AM
Points: 2,836, Visits: 5,066
Tara-1044200 (6/11/2013)
I want to do this.

select count(*) from
(
select col1,col2,......col18 from REVemployee.tbemp
group by col1,col2,......col18 HAVING COUNT(*)>1
)a


is there a better way of doing the same for better proformance?


Looks fine to me. But you also can try this:

select count(*) from 
(
select null a from REVemployee.tbemp
group by col1,col2,......col18 HAVING COUNT(*)>1
)a

You might have slightly better performance.

You can also find duplicates using windowed function, but this very likely to be much slower.




_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1462510
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse