Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Code
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01084190
Message ID:
01084205
Vues:
9
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform