Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Code
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01084190
Message ID:
01084205
Views:
8
This message has been marked as the solution to the initial question of the thread.
>SQL 2000 is the version and yes the ChargeType can only be 1 or 2, the RptCode can only OR or PACU
>
Try
SELECT meetingnumber, 
	SUM( CASE WHEN ChargeType1 = '1' AND RptCode = 'PACU' THEN y_Sent_To_Charge ELSE 0 END) AS PACU_ChargeType1,
	SUM( CASE WHEN ChargeType1 = '2' AND RptCode = 'PACU' THEN y_Sent_To_Charge ELSE 0 END) AS PACU_ChargeType2,
	SUM( CASE WHEN ChargeType1 = '1' AND RptCode = 'OR' THEN y_Sent_To_Charge ELSE 0 END) AS OR_ChargeType1,
	SUM( CASE WHEN ChargeType1 = '2' AND RptCode = 'OR' THEN y_Sent_To_Charge ELSE 0 END) AS OR_ChargeType2
  FROM ( < your query > ) dt1
  GROUP BY meetingnumber 
Or you can combine it with the original query.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform