Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sql query regarding order

 
swapnil kataria
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please see the query

SELECT * FROM EMP_LIST WHERE
NAME LIKE '%RAHUL%' OR
NAME LIKE '%SMITH%' OR
NAME LIKE '%SANJANA%' OR
NAME LIKE '%AMIT%' ;

when i run this query, it is retrieving records fine, but it is not coming in proper order,

i means, i want records mathcing 'RAHUL' should come first, and then records matching 'SMITH' should come second and so on,

is there any way to handle order is such a way, please help
 
Rob Spoor
Sheriff
Pie
Posts: 20510
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about SQL's ORDER BY clause?

I'll move this thread to our JDBC forum.
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a simple SQL query using the "ORDER BY" clause will result in alphabetically ordered records. However, it will not order as you have specified.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic