Transposing and cross tabulation are common tasks in maths and stats, and languages like R, Python, SAS, or even tools like Tableau are much better suited to it.
Using SQL for transposing data is using the proverbial hammer because you lack better tools.