Good morning companions,
I have the following table co_orderdetail
The detail is that I want to list it in columns in the field ordercoin
I have executed it like this and it shows me this result:
SELECT
id_order,
CASE ordercoin when 1 then coin end firstcoin,
CASE ordercoin when 2 then coin end seconcoin,
CASE ordercoin when 1 then monto end firstmonto,
CASE ordercoin when 2 then monto end seconmonto
FROM co_orderdetail
group by id_order,
CASE ordercoin when 1 then coin end,
CASE ordercoin when 2 then coin end,
CASE ordercoin when 1 then monto end ,
CASE ordercoin when 2 then monto end;
I do not want to make any sub consultation
The result I hope for is: