Error in Aggregates

  • hi,

    I'm trying to make a count on the basis of a bit value.

    SELECT COUNT(CASE WHEN ISWaiting = 0 THEN 1 ELSE 0 END) NOTWAITING

    ,COUNT(CASE WHEN IsWaiting =1 THEN 1 ELSE 0 END) WAITING

    ,DATE

    FROM TBL

    WHERE Date BETWEEN @FromDate AND @ToDate

    GROUP BY DATE

    but i'm getting the same value for both the counts. where i'm making mistake?

    Early help would be appreciated much

    Thanks,

    Regards,

    Ami.

  • Don't count, sum. Count bases on existance.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Wow Craig,

    Thanks,

    Just now I found out the mistake and thought of posting the answer.

    You are so quick and posted before me.

    Thanks a lot,

    Ami

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply