Subject | Firebird Derived tables |
---|---|
Author | terrypurse |
Post date | 2004-03-16T11:45Z |
Does Firebird support derived tables?
ie
SELECT C.ID, C.COMPANY, C.PARTNER, C.JOB_TYPE, C.FEE_ESTIMATE,
C.DATE_OF_APPOINTMENT, C.ADJUSTMENT, C.PROVISION,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE is null
AND L.CCODE = C.ID) AS COST,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'DC'
AND L.CCODE = C.ID) AS DIRECTCOST,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'FN'
AND L.CCODE = C.ID) AS BILLING,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'EC'
AND L.CCODE = C.ID) AS EMPCOST
FROM CLIENTS C
Thanks
ie
SELECT C.ID, C.COMPANY, C.PARTNER, C.JOB_TYPE, C.FEE_ESTIMATE,
C.DATE_OF_APPOINTMENT, C.ADJUSTMENT, C.PROVISION,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE is null
AND L.CCODE = C.ID) AS COST,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'DC'
AND L.CCODE = C.ID) AS DIRECTCOST,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'FN'
AND L.CCODE = C.ID) AS BILLING,
(SELECT SUM(COST) FROM LEDGER L
WHERE L.TYPE = 'EC'
AND L.CCODE = C.ID) AS EMPCOST
FROM CLIENTS C
Thanks