Jump to content

SQL : Showing Last 5 Rows of a table


MystKnight
 Share

Recommended Posts

Hello

I'm totally noob to AutoIt. Ive been using it for a few weeks only but id like to say its really fun.

Now, i made my own exe without gui. Ive wanted to add gui to add records to my table and show last 5 rows in an order.

But i really have no idea what to use.

Any help is appreciated

Link to comment
Share on other sites

 Depending on the database you are using one of these methods should work for getting the last 5 rows from the table.

SELECT *FROM 
 (SELECT * FROM my_table ORDER BY col_name_1)WHERE ROWNUM < 5;

SELECT *FROM my_table aWHERE 
 5 >= (SELECT COUNT(DISTINCT maxcol)       FROM my_table b       WHERE b.maxcol <= a.maxcol
ORDER BY maxcol;
Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...