Subject | SQL Question |
---|---|
Author | Robert F. Tulloch |
Post date | 2000-10-27T16:28:31Z |
Hi:
SELECT ASSOCID,
(SELECT COUNT (A1.ASSOCID)
FROM ASSOC_C A1
WHERE (A1.INITL_DATE <= '03/01/2000')) AS TotalJoined,
(SELECT COUNT (A2.ASSOCID)
FROM ASSOC_C A2
WHERE (A2.CANCL_DATE < '03/01/2000')) AS TotCancelled
FROM ASSOC_C A0
WHERE A0.ASSOCID = 1 AND A0.ID = 685;
I want to get another field returned which is TotalJoined -
TotCancelled. Is there any way to do this? I do have references:
Joe Celko's books etc. etc. but can't seem to figure this out (Get
something to work).
Any suggestions appreciated.
Best
regards
SELECT ASSOCID,
(SELECT COUNT (A1.ASSOCID)
FROM ASSOC_C A1
WHERE (A1.INITL_DATE <= '03/01/2000')) AS TotalJoined,
(SELECT COUNT (A2.ASSOCID)
FROM ASSOC_C A2
WHERE (A2.CANCL_DATE < '03/01/2000')) AS TotCancelled
FROM ASSOC_C A0
WHERE A0.ASSOCID = 1 AND A0.ID = 685;
I want to get another field returned which is TotalJoined -
TotCancelled. Is there any way to do this? I do have references:
Joe Celko's books etc. etc. but can't seem to figure this out (Get
something to work).
Any suggestions appreciated.
Best
regards