Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    3

    Unanswered: 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;

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •