hi friends, i ever found any question like this, how to show any data in crosstab query.
The case like this:
I have one table like this (table name people):
=================
No Name Gender
=================
1 Sukrisno M
2 Xpcer M
3 Elizabeth F
if we want to count the people group by the gender, we can use the query like this:
SELECT Gender, count(No)
FROM people
GROUP BY Gender
and the result is like this:
================
Gender count(No)
================
M 2
F 1
And now, i want to show you, how to show the result in horizontal tab like below:
==========
M F
==========
2 1
the query is:
SELECT SUM(If(Gender='M',1,0)) AS 'M',
SUM (If(Gender='F',1,0)) AS 'F'
FROM people
Enjoy with it. if you need any query like this, you can ask for me, i'm very pleasure to help you.