June 13, 2005 at 10:34 am
Hi............
I have a table which gives me the week number in a month and the total of tickets in the particular week.
week_number total date
------------- ------ ----------
2 10 06/08/2005
2 4 06/09/2005
2 5 06/10/2005
i need an output which looks like
week_number total
------------- ------
2 19
can anyone tell me how will i get this
Thanks
June 13, 2005 at 11:22 am
try this
select distinct(week_number), sum(total)
from 'your table'
thats what u need?
by the way r u SRG's pinky?
June 13, 2005 at 11:27 am
Not sure that distinct will work without a group by... this may work better :
Select Week_number, sum(Total) from dbo.YourTable group by week_number
BTW, why r u keeping the week number in the table??
This is something that you can easyly calculate from the date.
June 13, 2005 at 11:31 am
HEY THE TOTAL FIELD IS THE COUNT FIELD WHICH I GOT IT FROM OTHER TABLE
June 13, 2005 at 11:35 am
hey i have these fields
month,year,week_number, total(this is the count of a field in other table)
June 13, 2005 at 11:38 am
The can post the table definition with some sample data so we can create the correct query this time.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply