Pages

11.26.2010

fungsi decode dalam oracle

Salam,

semoga anda semua dlm keadaan sihat dan bahagia...

lama tul x update blog ni.. dilanda kesibukan..

hari ni nak share psl penggunaan decode dalam oracle

ni sample sintax sql

select
count(decode (state,'192009200112102152338935988411','PUTRAJAYA')) PUTRAJAYA,
count(decode (state,'010021064214100579586504522753','JOHOR')) JOHOR,
count(decode (state,'010021064214100579590790423197','KEDAH')) KEDAH,
count(decode (state,'010021064214100579594564723444','KELANTAN')) KELANTAN,
count(decode (state,'010021064214100579597220823691','MELAKA')) MELAKA,
count(decode (state,'010021064214100579599413723938','N9')) N9,
count(decode (state,'010021064214100579607276024795','PERLIS')) PERLIS,
count(decode (state,'010021064214100579644489527382','PAHANG')) PAHANG,
count(decode (state,'010021064214100579664170329689','P.PINANG')) P.PINANG,
count(decode (state,'010021064214100579667737330179','SABAH')) SABAH,
count(decode (state,'010021064214100579670332030441','SELANGOR')) SELANGOR,
count(decode (state,'010021064214100579672112530693','SARAWAK')) SARAWAK,
count(decode (state,'010021064214100579677523331757','TERENGGANU')) TERENGGANU,
count(decode (state,'010021064214100579707565133805','WP')) WP
from namatable
date_reg BETWEEN to_date('01/11/2010','dd/mm/yyyy') and to_date('30/11/2010','dd/mm/yyyy')

Hasilnya :-



sintax oracle di atas utk mengira data atau dalam table mengikut negeri. korang leh guna sintax dia atas untuk membuat statistik.

sekian terima kasih.




1 comment:

Statistik Blog

Jumlah Posting dan Komentar Blog buah artikel telah ditulis
buah komentar masuk

Widget edited by Harri