Thema: Delphi SQL Problem

Einzelnen Beitrag anzeigen

manfred_h

Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
 
Delphi XE2 Enterprise
 
#4

Re: SQL Problem

  Alt 17. Mär 2009, 18:44
Wow, das ging schnellll super

das wars:
SQL-Code:
SELECT
    C_NO,
    SUM(IIF ( TODO_TYPE = 'MEMBER_FEE', 1, 0)) AS MF,
    SUM(IIF ( TODO_TYPE = 'TARGET_SET', 1, 0)) AS TS,
    SUM(IIF ( TODO_TYPE = 'ANNUAL_REPORT', 1, 0)) AS AR,
    SUM(IIF ( TODO_TYPE = 'ELECTIONS_TO_HQ', 1, 0)) AS E_HQ,
    SUM(IIF ( TODO_TYPE = 'N_M_P', 1, 0)) AS N_M_P,
    SUM(IIF ( TODO_TYPE = 'PASTORS_BANQUETS', 1, 0)) AS PB,
    SUM(IIF ( TODO_TYPE = 'MEMBER_DINNER', 1, 0)) AS MD,
    (CASE
      WHEN EXTRACT (MONTH FROM TODO_DATE ) BETWEEN 1 AND 5
       THEN EXTRACT (YEAR FROM TODO_DATE)
      ELSE
       EXTRACT (YEAR FROM TODO_DATE) + 1 END ) B_YEAR
FROM
    CAMPS_D_TODO
GROUP BY
   C_NO, B_YEAR;
Besten Dank Euch beiden!
Shalom
Manfred
  Mit Zitat antworten Zitat