Cari Blog Ini

Rabu, Maret 17, 2010

How to make cross tab query in MySQL (database management)

As I wrote a script to display cross tab data (for my personal need), I searched for effective methods to get the job done. I came across many techniques that can be used to workout exactly the same job (Cross-tab). However, the simplest technique to do the job is using statement “SELECT DISTINCTROW”.


SELECT DISTINCTROW [FieldName], count([FieldName]) FROM [TableName] Group By [FieldName]

Example
SELECT DISTINCTROW stbayar , count(stbayar) as Jumlah
FROM pengunjung
GROUP BY stbayar
ORDER BY jumlah DESC

this will return

stbayar Jumlah
U 7216
J 5742
A 2987
P 1755
N 242
K 225
L 6

you might want to create your own tricks, please let me know if they work !

Keep sharing on the spirit of UBUNTU

How to make cross tab query in MySQL (database management)

As I wrote a script to display cross tab data (for my personal need), I searched for effective methods to get the job done. I came across many techniques that can be used to workout exactly the same job (Cross-tab). However, the simplest technique to do the job is using statement “SELECT DISTINCTROW”.


SELECT DISTINCTROW [FieldName], count([FieldName]) FROM [TableName] Group By [FieldName]

Example
SELECT DISTINCTROW stbayar , count(stbayar) as Jumlah
FROM pengunjung
GROUP BY stbayar
ORDER BY jumlah DESC

this will return

stbayar Jumlah
U 7216
J 5742
A 2987
P 1755
N 242
K 225
L 6

you might want to create your own tricks, please let me know if they work !

Keep sharing on the spirit of UBUNTU

Meninjau Kriteria inklusi dan eksklusi dalam pengambilan sampel untuk penelitian.

Menentukan kriteria inklusi dan atau ekslusi dalam penelitian seringkali menjadi permasalahan tersendiri, terutama bagi para mahasiswa yan...