Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
muzzettemm
Posting Yak Master
212 Posts |
Posted - 2009-08-25 : 23:09:18
|
Hi guys I have a problem, the Colums in the matrix exactly in the order they should be but when I run a query the totals I get are completely differnt then the ones I am getting on the matrix and I dont understand why.here is the query I ranSELECT People_tbls.[Parent First Name], People_tbls.[Parent Last Name], Tanf_tbl.[Earned hours], Tanf_tbl.[Catagory for hours], Tanf_tbl.[Services Covered], Tanf_tbl.[Contact Date], People_tbls.[Referral Status]FROM People_tbls INNER JOIN Tanf_tbl ON People_tbls.[Parent ID] = Tanf_tbl.[Parent ID]WHERE (Tanf_tbl.[Contact Date] BETWEEN CONVERT(DATETIME, '2009-07-01 00:00:00', 102) AND CONVERT(DATETIME, '2009-07-31 00:00:00', 102)) AND (People_tbls.[Referral Status] = N'ACTIVE')ORDER BY People_tbls.[Parent Last Name] this is what this gave me for this one is 57 but on RS in the matrix I get 56Armendariz 1Armendariz 1Armendariz 4Armendariz 1Armendariz 1Armendariz NULLArmendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 4Armendariz 1Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 4Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2Armendariz 2and for this one = 92 but on the RS it says 10Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 2Francisco Beltran 4Francisco Beltran 4Francisco Beltran 4Francisco Beltran 4Francisco Beltran 2Francisco Beltran 1Francisco Beltran 2Francisco Beltran 1Francisco Beltran 2Francisco Beltran 4Francisco Beltran 2is there something wrong with the query I'm running[code]SELECT People_tbls.[Parent ID], People_tbls.[Parent Last Name], People_tbls.[Referral Status], TanfActivity_tbl.[Contact Date], TanfActivity_tbl.[Earned hours], TanfActivity_tbl.[Catagory for hours], TanfActivity_tbl.[Services Covered], People_tbls.[Parent First Name]FROM People_tbls INNER JOIN TanfActivity_tbl ON People_tbls.[Parent ID] = TanfActivity_tbl.[Parent ID]WHERE (People_tbls.[Referral Status] = N'Active') AND (TanfActivity_tbl.[Catagory for hours] IN (N'ITP', N'Parenting', N'Education', N'Travel Time', N'Cultural', N'Job Skills Training')) AND (TanfActivity_tbl.[Contact Date] BETWEEN @Beginning_ContactDate AND @End_ContactDate)ORDER BY CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'ITP' THEN 0 ELSE 1 END, CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'Parenting' THEN 0 ELSE 1 END, CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'Job Skills Training' THEN 0 ELSE 1 END, CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'Travel Time' THEN 0 ELSE 1 END, CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'Cultural' THEN 0 ELSE 1 END, CASE WHEN TanfActivity_tbl.[Catagory for hours] = N'Education' THEN 0 ELSE 1 END, TanfActivity_tbl.[Catagory for hours], TanfActivity_tbl.[Services Covered], People_tbls.[Parent Last Name][/code[] |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-08-27 : 10:50:37
|
whats the expression you gave for getting total? or did you just added the subtotal column? |
|
|
|
|
|
|
|