0

I'm really stuck on this cross-tab problem. I have read many solution which was solved here in this website but could not get a handle on this. I would really appreciate if someone could help me.

I have a crosstab query in Ms. Access 2010 that I would I like to transition to MySQL. I'm not familiar with the cross tab in MYSQL.

My MS-Access Crosstab is;

TRANSFORM Count(AppNamesAndAllUsers_QRY.User_Name) AS CountOfUser_Name
SELECT Tbl_HRList.[Organizational Code], Tbl_HRList.[Organizational Unit], Tbl_HRList.Team, Count(AppNamesAndAllUsers_QRY.User_Name) AS [Total Of User Name]
FROM Tbl_HRList INNER JOIN AppNamesAndAllUsers_QRY ON Tbl_HRList.Employee_ID = AppNamesAndAllUsers_QRY.Employee_ID
WHERE (((AppNamesAndAllUsers_QRY.User_Status)="Active"))
GROUP BY Tbl_HRList.[Organizational Code], Tbl_HRList.[Organizational Unit], Tbl_HRList.Team, AppNamesAndAllUsers_QRY.User_Status
PIVOT AppNamesAndAllUsers_QRY.Application_Name;

How can I convert this query to MYSql?

Thanks in advance

1 Answers1

0

MySql is very bad for pivot. Isnt automatic like other rdbms and you have to do some programing.

Here is the best example i have found.

MySQL pivot table

Community
  • 1
  • 1
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118