Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case when
Message
From
24/11/2017 03:12:23
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Case when
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01655806
Message ID:
01655806
Views:
58
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.
Next
Reply
Map
View

Click here to load this message in the networking platform