scouser
Registered User.
- Local time
- Today, 20:13
- Joined
- Nov 25, 2003
- Messages
- 767
Hi. I have a table that contains licence details.
LicenceAgreementID / LicenceKey / NumOfLicencePurchased
Each licence agreement can have one or many licence keys, each licence key can have one or many licences
I would like a query that groups by LicenceAgreementID then sums the NumOfLicences for the the LicenceAgreementId.
Query so far:
It may be that I have to redesign my tables, if so I will will.
Current Output:
LicenceAgreementID...........LicenceKey.........NumOfLicencePurchased
12345..............................AAA-BBB-CCC.....10
12345..............................ZZZ-BBB-CCC.....10
12345..............................XXX-BBB-CCC.....10
The output I would would be:
LicenceAgreementID...........LicenceKey.........NumOfLicencePurchased
12345..............................AAA-BBB-CCC.....30
......................................ZZZ-BBB-CCC.....
......................................XXX-BBB-CCC.....
or something along those lines!
Can anyone share my vision?
Thanks,
Phil.
LicenceAgreementID / LicenceKey / NumOfLicencePurchased
Each licence agreement can have one or many licence keys, each licence key can have one or many licences
I would like a query that groups by LicenceAgreementID then sums the NumOfLicences for the the LicenceAgreementId.
Query so far:
Code:
SELECT tblLicenseDetails.LicenseAgreementID, tblLicenseDetails.LicenseKey, tblLicenseDetails.NumOfLicensePurch
FROM tblLicenseDetails
GROUP BY tblLicenseDetails.LicenseAgreementID, tblLicenseDetails.LicenseKey, tblLicenseDetails.NumOfLicensePurch
HAVING (((tblLicenseDetails.LicenseAgreementID) Is Not Null));
It may be that I have to redesign my tables, if so I will will.
Current Output:
LicenceAgreementID...........LicenceKey.........NumOfLicencePurchased
12345..............................AAA-BBB-CCC.....10
12345..............................ZZZ-BBB-CCC.....10
12345..............................XXX-BBB-CCC.....10
The output I would would be:
LicenceAgreementID...........LicenceKey.........NumOfLicencePurchased
12345..............................AAA-BBB-CCC.....30
......................................ZZZ-BBB-CCC.....
......................................XXX-BBB-CCC.....
or something along those lines!
Can anyone share my vision?
Thanks,
Phil.