Re: Help with missing data in query



I just wanted to thank you for your help.

"Hugo Kornelis" wrote:

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

.



Relevant Pages

  • Re: Help with missing data in query
    ... Change the last par tof the query to ... GROUP BY m.MonthName WITH ROLLUP ... Hugo Kornelis, SQL Server MVP ... My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis ...
    (microsoft.public.sqlserver.mseq)
  • Re: Help with missing data in query
    ... I did go to that site But I couldn't figure out how to upload anything. ... Try changing the ORDER BY clause to read either ... GROUP BY m.MonthName WITH ROLLUP ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: Uploading documents fail - SharePoint Services/Remote SQL 2k Server
    ... Mike Walsh, Helsinki, Finland ... was unable to upload files larger than 5Mb, ... solve it by allocating more memory for SQL server. ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Mange Large file in the database
    ... With a big amount of data that is uploaded to SQL server from the Web you ... MS SQL can handle huge amount of data. ... model for your database. ... project is to upload data from clinte machine and save these data to SQL ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SQL Humor
    ... Hugo Kornelis wrote: ... SQL Server will often produce the same execution for both versions. ... the big questions for the RM, *for me* seem to include view updatability which has to do with the operators of the algebra as well as whether a relational engine can implement customary features such as concurrency control and presentation coherence without being written in a language that eschews the relational operators. ...
    (comp.databases.theory)