Sql Query

  • Hi Sql Guru's,

    I have a table like this

    eno ename Gender

    01 xx Male

    02 yy Female

    03 zz Male

    How can i get like this through query?

    eno ename Male Female

    01 xx Male

    02 yy Female

    03 zz Male

    Thanks in Advance

    Ramaa

  • Use a Case statement on the data in gender for the new columns.  For example:

    select

    eno, ename, (case gender when 'Male' then 'Male' else '' end) as Male,

    (case gender when 'Female' then 'Female' else '' end) as Female

    from mytable_

    --James.

  • Hi James,

    Thank You very much. It works fine for me.

    Ramaa

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply