I have this output:
SELECT Arquivo, Safra, LinhasA FROM t411 LIMIT 10;
I would like to get this kind of output:
Is there any way directly using SELECT?
... can also be by PROCEDURE if necessary.
I would really appreciate it if anyone can help. I use MySQL Server (latest version) and run my selects through MySQL Workbench
I don't understand why you used limit 10 but, Can you try this?
select
Arquivo,
max(case when Safra = '2019/2020' then LinhasA else 0 end) as '2019/2020',
max(case when Safra = '2020/2021' then LinhasA else 0 end) as '2020/2021',
max(case when Safra = '2021/2022' then LinhasA ELSE 0 end) as '2021/2022'
from t411
group by 1;