Change the order of fields fixed values

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 25 May 2004 6:38 pm

Sometimes we want a query has a certain order (other than the order by or DESC). Example: Let's say there is a LITERACY camp, which may have M-male, F – female or not informed. How to make so that the query returns exactly in this order? M, F and N?? Use the INSTR for that! See:
Code: Select all
SQL> select * from a;

F
-
N
M
F

3 rows selected.

SQL> select * from a
  2  order by instr('MFN', field);

F
-
M
F
N

3 rows selected.

SQL>
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Fri, 04 Jun 2004 8:54 am

Very interesting this forum, I registered today and I am an apprentice in respect of the database, and I liked the generous with that put the solutions, valeu by one more tip ...
Marceleza
Location: São Paulo

Fazer o bem sem olhar a quem....


  • See also
    Replies
    Views
    Last Post


    Return to SQL

    Who is online

    Users browsing this forum: Bing [Bot] and 3 guests