If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Decode Option Use(Like Pivot Table output)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-11, 12:07
karthik_192me karthik_192me is offline
Registered User
 
Join Date: May 2011
Posts: 3
Decode Option Use(Like Pivot Table output)

my DB is

country| id |Plan
DE | XX1 | P
US | XX2 | W
US | XX3 | P
DE | XX4 | P

my output shd like

Plan_|_DE_|_US
W | 0 | 2
P | 2 | 1

i m using DECODE option, not getting exact output...Pl help me

SELECT plan,count(DECODE(country,'DE',id)),count(DECODE(c ountry,'US',id))
from MDL ORDER BY Plan;
Reply With Quote
  #2 (permalink)  
Old 05-19-11, 12:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by karthik_192me View Post
i m using DECODE option, not getting exact output...Pl help me
DECODE is oracle, not mysql -- you should ask in the oracle forum
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On