December 3, 2009 at 10:27 am
When
Select Count(*) From Tbltracking where Year(DateStamp) = 2009
returns no records I want to display 0 for the count.
hint:
there is All/Distinct clause I may have to use?
December 3, 2009 at 10:33 am
I'm confused. I ran a query very similar to this one, Select Count(*) From Tbltracking where Year(DateStamp) = 2009, against a table in one of my databases and it returned 0 when it could find any records. What seems to be the problem you are experiencing?
December 3, 2009 at 11:14 am
I found the solution.
the secret was to use the Group By All clause, then one would see the zeros for the Count if there are no records that meet the condition.
Thanks for helping.
December 3, 2009 at 12:44 pm
??????? :blink: ????????
Care to share your solution; and I mean the code, not just what you did?
December 3, 2009 at 1:02 pm
Faye Fouladi (12/3/2009)
I found the solution.the secret was to use the Group By All clause, then one would see the zeros for the Count if there are no records that meet the condition.
I'm pretty sure that you've got that backwards.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply