Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    11

    Unanswered: Substituting values in a view

    I have a table with
    Co1 and Col2.
    Col2 can have has values "AA", 'BB', and 'CC'.
    I have to create a view with those two columns and it should have '01' instead of 'AA' , '02' instead of 'BB' and '03' instead of 'CC'.
    How should I code it?
    Thanks.

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Use CASE expression.

  3. #3
    Join Date
    Jul 2009
    Posts
    150
    select case col2 when 'AA' then '01' when 'BB' then '02' when 'CC' then '03' else col2 end
    from table1


    Kara

Posting Permissions

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