November 20, 2003 at 9:19 am
hi there,
Trying to group some data by a few criteria and its not coming out like I'm expecting.
Data:
intMasterAcctIDintTaxCategoryintLandUseCodelngLandArealngLandValuelngAgricultureCreditlngYardItemsValuelngBuildingValuelngTotalAssessedintMixedLandUseCodelngLandAreaSQFTlngLandAreaAcre
16304491.59612000.0000.0000.0000.000012000.0000069521.7581.596
163044978408.086220.0000.0000.0000.000086220.00008278408.01.8
1630118712.09580.0000.0000.0000.00009580.0000828712.00.2
1630110.0.0000.0000.000074700.000074700.000000.00.0
16304490.0.0000.0000.0000914800.0000914800.000000.00.0
1630110.0.0000.00004100.0000.00004100.000000.00.0
16304490.0.0000.000046900.0000.000046900.000000.00.0
SQL:
SELECTintMasterAcctID,
intTaxCategory,
intLandUseCode,
intMixedLandUseCode,
sum(lngLandArea) lngLandArea,
sum(lngLandValue) lngLandValue,
sum(lngAgricultureCredit) lngAgricultureCredit,
sum(lngYardItemsValue) lngYardItemsValue,
sum(lngBuildingValue) lngBuildingValue,
sum(lngTotalAssessed) lngTotalAssessed,
sum(lngLandAreaSQFT) lngLandAreaSQFT,
sum(lngLandAreaACRE) lngLandAreaACRE
FROMAssessmentSummarys
WHERE intMasterAcctID=1630
GROUP BYintMasterAcctID,
intTaxCategory,
intMixedLandUseCode,
intLandUseCode
GO
So I have 7 lines of data that I want to get 2 lines out of. The grouping of intMasterAcctID,intTaxCategory,intMixedLandUseCode,intLandUseCode.
There are only 2 values in the data for these fields so why do I get 4 lines as a result set?
Just confused... Probably something stupid but I cant see it.
Thanks,
Chris
November 20, 2003 at 10:35 am
There are 4 distinct combinations of intLandUseCode and intMixedLandUseCode.
intLandUseCode intMixedLandUseCode
-------------- -------------------
1 0
1 82
49 0
49 82
To get this to only two lines, you will need to remove one of these two columns.
Brian
November 20, 2003 at 10:44 am
*smacks forehead*
Perfectly obvious now that I'm looking at it.
Thanks,
Chris
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply