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

Count Distinct Expand / Collapse
Author
Message
Posted Monday, January 24, 2011 10:37 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, October 11, 2011 1:51 PM
Points: 341, Visits: 311
I got it right by eliminating the answers which were wrong. Incidentally, maybe this is something specific with SSRS (which I have no experience with), but my initial instinct was to say that none of the answers was correct as the query would return with the following:

"Must declare the scalar variable '@startDate'"

Probably being too nitpicky about that though...
Post #1052549
Posted Monday, January 24, 2011 11:07 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, June 16, 2014 9:38 AM
Points: 2,163, Visits: 2,189
Thanks for the question.
Post #1052582
Posted Monday, January 24, 2011 11:17 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 5:28 PM
Points: 8,562, Visits: 9,060
Nice straighforward question. I like them like this.

Tom
Post #1052591
Posted Monday, January 24, 2011 12:52 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 4:21 PM
Points: 21,228, Visits: 14,933
Good question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1052641
Posted Monday, January 24, 2011 11:08 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 7:50 AM
Points: 3,859, Visits: 5,001
FargoUT (1/24/2011)
I got it right by eliminating the answers which were wrong. Incidentally, maybe this is something specific with SSRS (which I have no experience with), but my initial instinct was to say that none of the answers was correct as the query would return with the following:

"Must declare the scalar variable '@startDate'"

Probably being too nitpicky about that though...


Within SSRS, when a query is written with variables like this, when the report is compiled, parameters are build, which must be populated (via user input) before the report is run.


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1052874
Posted Monday, January 31, 2011 8:11 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, September 15, 2011 11:50 AM
Points: 314, Visits: 35
If requesting parts ordered more than once, need to query for diff > 0
Post #1056214
Posted Monday, January 31, 2011 9:26 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, April 27, 2014 6:26 AM
Points: 1,521, Visits: 3,036
twalpole (1/31/2011)
If requesting parts ordered more than once, need to query for diff > 0

Nice catch. The difference is between a count(DISTINCT) and and a straight count. With all unique parts, the count(distinct) would equal the count() and the difference would be zero. With a repeat order for a part, the count(DISTINCT) would be less than the straight-up count().
Post #1056261
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse