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.