i have a table named temp. columns are id, telco, shortcode,hotkey.
id telco shortcode hotkey
1 asdf 123 ib
2 gra 123 sb
3 cc 123 sb
4 bl 123 ibb
using mysql query i want output count(shortcode) group by telco where hotkey ib shortcode 123 and
count(shortcode) group by telco where hotkey sb shortcode 123
telco ib sb
asdf 1 0
gra 0 1
cc 0 1
bl 1 0
if i use the following query
SELECT COUNT(`shortcode`) WHERE `hotkey` = 'ib' AND `shortcode` = 123
SELECT COUNT(`shortcode`) WHERE `hotkey` = 'sb' AND `shortcode` = 123
then i get out in the following way
telco ib
asdf 1
gra 0
cc 0
bl 1
telco sb
asdf 1
gra 0
cc 0
bl 1
but i don’t want this
you want to use sum case like
Note current versions of Oracle an Sql server have the option to use the pivot syntax