• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interesting info about "select with order by"

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi alls,
This site has helped me in many ways, so thought of sharing something which is really important for ppl using JDBC.
problem:
if u use the order by clause with select query, your ResultSet will only be able to fetch first few records.
eg: select user_name from emp order by sno
If you execute the above query i am sure u will be perplexed to see its not working.
solution:
use the query like this.
select * from (select user_name from emp order by sno)
then it will work
hope its useful to all, any further queries plzz feel free to ask
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really? I have never had any problems with the select statement using order by. This may have to do with your DB and/or DB driver.
 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never had any problems either. You might want to run your original query in your sql editor and see how it compares to your ResultSet. I think something else is going on
reply
    Bookmark Topic Watch Topic
  • New Topic