Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Grouping Issue

$
0
0

Hi,

Why the SQL below GROUPS at certain times only:

SELECT      Currency.CurrencyISOCode, Currency.CurrencyCountry, Currency.Currency, Sum(BHDDeliveryDet.Quantity) AS Quantity,
                      BHDDeliveryDet.Denomination, Sum(BHDDeliveryDet.Quantity) * BHDDeliveryDet.Denomination AS 'Total'
FROM          BHDDeliveryDet INNER JOIN
                      Currency ON BHDDeliveryDet.Currencyid = Currency.Currencyid INNER JOIN
                      CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid
WHERE   BHDDeliveryDet.BHDDeliveryNo = 22 AND CurrencyDetails.DenominationType = 'Currency' AND BHDDeliveryDet.Denomination=CurrencyDetails.Denomination
GROUP BY  BHDDeliveryDet.Denomination, BHDDeliveryDet.BHDDeliveryNo, Currency.CurrencyISOCode, Currency.CurrencyCountry, Currency.Currency,
                      BHDDeliveryDet.Quantity * BHDDeliveryDet.Denomination, CurrencyDetails.DenominationType
ORDER BY  BHDDeliveryDet.Denomination DESC;

I need this one to be grouped always.  Help is appreciated.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>