SQL statement

Results 1 to 2 of 2

Thread: SQL statement

  1. #1
    Join Date
    Dec 1969

    Default SQL statement

    I have a db2 database with a field of random numbers between 1-1000. I want them in highest to lowest order, which I can do. The problem is after I get them in order. I just want the next to the highest record. Not the first one. Any ideas on how I could do this with the SQL statement?

  2. #2
    Join Date
    Dec 1969

    Default Not the absolute best way...

    but this will work, and since you&#039;re only throwing away one record it&#039;s not terrible. <BR><BR>Select Top 2 Blah From Table Order By Blah Desc<BR><BR>Then just use the second row. <BR><BR>Someone here can maybe find a better way, but this will work with minimal waste.

Posting Permissions

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