help with mysql query |
Hi All,
i have a table in mysql with the following data Code: Table name Test i am looking for a mysql query which will give the below mentioned output Code:
you need a pivot like
SELECT t.asset, SUM(IF(t.`status`="In Stock",1,0)) AS "In_Stock", SUM(IF(t.`status`="Allocated",1,0)) AS "Allocated", SUM(IF(t.`status`="Decommissioned",1,0)) AS "Decommissioned", t.location FROM tester t GROUP BY t.asset, t.location Bill |
Welcome Guest, Not a member yet? Register Sign In |