Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Unanswered: Selective sort on table : query please

    Hi,

    I need to understand and write a query for the following situation.
    I have a table with the following fields

    email
    type : (home, work, roaming)
    address

    I wanted to write a query that displays the results in the following fashion.
    First all the emails with type work are listed.
    Secondly all the emails with type home are listed
    Thirdly all the emails with type roaming are listed.

    I wanted to know if I could write such a query.
    Unfortunately, the type is a string instead of a number.

    Thanx in advance.
    Aruneesh

  2. #2
    Join Date
    Jun 2003
    Posts
    2
    If your types are fixed follwing might help you..

    select name, email, email_type, address from table_name
    order by decode(email_type, 'work', 1, 'home', 2, 'roaming', 3,0)

  3. #3
    Join Date
    Jul 2003
    Location
    US
    Posts
    314

    Arrow Thanx

    aragasu
    Thanx a ton dude. It really helped me much.
    Aruneesh

Posting Permissions

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