• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Reg:Getting vaues from DB with out sorting

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to get data from Employee table like

select * from Employee where id in(8,7,5,9,1);

It is fetching data like

1
5
7
8
9
But i need like
8
7
5
9
1

 
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a few choices:
1) Do the queries one at a time
2) Do the "sort" in your desired order after getting back from the database if using JDBC
3) Sort in Oracle. I think you can define a custom function (which returns your desired order) and sort by that. (I did it in a different database, but I think Oracle supports it too.)
 
reply
    Bookmark Topic Watch Topic
  • New Topic