Subject | Selection SQL advice |
---|---|
Author | jacobhavkrog |
Post date | 2012-12-20T09:56:26Z |
Hi -
I have a table whith monthly payment data, like this:
AccountNo, MonthNo, PaymentAmount
22,1,33000
22,2,33000
22,3,33000
22,4,33000
22,5,33000
22,6,33000
22,7,33000
22,8,33000
22,9,33000
22,10,33000
22,11,33000
22,12,33000
23,1,34000
.....
In the above example, for AccountNo 22 and for each month jan to dec, the payment is 33000.
For each AccountNo there should be an entry for each month 1 to 12.
Now, I've got a problem where in some cases a monthly entry is missing.
How do I construct a SQL query, that selects the AccountNo's where one of the monthly entries is missing?
Thanks for your help!
Jacob
I have a table whith monthly payment data, like this:
AccountNo, MonthNo, PaymentAmount
22,1,33000
22,2,33000
22,3,33000
22,4,33000
22,5,33000
22,6,33000
22,7,33000
22,8,33000
22,9,33000
22,10,33000
22,11,33000
22,12,33000
23,1,34000
.....
In the above example, for AccountNo 22 and for each month jan to dec, the payment is 33000.
For each AccountNo there should be an entry for each month 1 to 12.
Now, I've got a problem where in some cases a monthly entry is missing.
How do I construct a SQL query, that selects the AccountNo's where one of the monthly entries is missing?
Thanks for your help!
Jacob