In given query I want to give condition: if mha(material handling area) has name HB1(mha='HB1') then CAST(SUM(minloc) - SUM(noinloc) AS DECIMAL(6,0)) AS '_FREe places' divide with number 2. How is possible to writte that? I tried with IF clause but I get faeil msg.
SELECT mha, locstat, loctype, SUM(noinloc) '_Kolli', SUM(minloc) '_Plasser', CAST(SUM(minloc) - SUM(noinloc) AS DECIMAL(6,0)) AS '_Free places'' FROM L30T1 GROUP BY mha, locstat, loctype ORDER BY mha, locstat, loctype
Aucun commentaire:
Enregistrer un commentaire