Re: Help with missing data in query
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 18 Aug 2007 00:03:45 +0200
On Thu, 16 Aug 2007 19:38:04 -0700, SLIMSHIM wrote:
THanx for the help
I did go to that site But I couldn't figure out how to upload anything.
Hi slimshim,
You don't need to upload anything. The site describes the information
you need to supply to give people the best chance to help you. You just
read that site, assemble the information, then post that information in
your next question.
after i tried your suggested changed this is what my result looks like
Jan 0 0 0
Total 12 0 12
Feb 0 0 0
Mar 0 0 0
Apr 0 0 0
May 0 0 0
Jun 0 0 0
Jul 12 0 12
Aug 0 0 0
Sep 0 0 0
Oct 0 0 0
Nov 0 0 0
Dec 0 0 0
I'm surpried - for a quick test on some scratch data, I got the total as
the very first line.
Try changing the ORDER BY clause to read either
GROUP BY m.MonthName WITH ROLLUP
ORDER BY GROUPING(m.MonthName), MIN(m.MonthId)
or
GROUP BY m.MonthID WITH ROLLUP
ORDER BY GROUPING(m.MonthID), m.MonthID
depending on which version of the query you are now using.
I was wondering if I could use COMPUTE intead of coalese to get the total
heading to the bottom ?
COMPUTE is a deprecated feature and will be removed in a future version
of SQL Server. Don't use it for new work, and replace it if you have it
in existing code.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.
- Follow-Ups:
- Re: Help with missing data in query
- From: SLIMSHIM
- Re: Help with missing data in query
- References:
- Re: Help with missing data in query
- From: Hugo Kornelis
- Re: Help with missing data in query
- From: SLIMSHIM
- Re: Help with missing data in query
- From: Hugo Kornelis
- Re: Help with missing data in query
- From: SLIMSHIM
- Re: Help with missing data in query
- Prev by Date: Re: Help with missing data in query
- Next by Date: Re: Help with missing data in query
- Previous by thread: Re: Help with missing data in query
- Next by thread: Re: Help with missing data in query
- Index(es):
Relevant Pages
|
|