Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Case when
Message
De
24/11/2017 03:12:23
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Case when
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01655806
Message ID:
01655806
Vues:
56
Dear Experts

I am using sqlserver 2008 and having these codes
select distinct(vou_no)as vou_no,MAX(acc_code)as acc_code,MAX(date)as date,MAX(code2)as code2,
SUM(case type when 'P' then dr_amount else 0 end)as bamount,
SUM(case type when 'A' and acc_code='4102021' then dr_amount else 0 end)as s_tax,
SUM(case type when 'A' and acc_code='4102022' then dr_amount else 0 end)as w_tax,
SUM(case type when 'A' and acc_code='4102023' then dr_amount else 0 end)as f_fee,
SUM(case type when 'A' and acc_code='4102024' then dr_amount else 0 end)as s_fee
 from crprp
 group by vou_no
It says:
Incorrect syntax near the keyword 'and'.

Please help me make this query run able.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform