View previous topic :: View next topic
|
Author |
Message |
pankajupadhyay Warnings : 1 New User
Joined: 04 May 2007 Posts: 13 Location: pune
|
|
|
|
hello,
plz tell me how can i select last row( and last five row ) from my table , i dont know how-many rows in my table plz give me proper example. |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi,
What do you exactly mean by
Quote: |
plz tell me how can i select last row( and last five row ) from my table
|
Actually, you have to arrange the rows using 'ORDER BY' clause as you want them and then select them.
Please refer to following SQL statements.
SELECE column_name FROM table_name
WHERE column_name = VALUE
ORDER BY column_name DESC
Use ASC/DESC for ascending/descending.
Do search on the forum for more results.
--Parag |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
hi pankajupadhyay
You can use the below query also,
Code: |
SELECE column_name FROM table_name
WHERE column_name = VALUE
ORDER BY column_name DESC
FETCH First 5 rows only; |
Thanks
Sai |
|
Back to top |
|
|
Nimesh.Srivastava
New User
Joined: 30 Nov 2006 Posts: 78 Location: SINGAPORE
|
|
|
|
pankajupadhyay,
Order By clause can only help if the column values of the column in question is generated sequentially or timestamp. Please specify clearly how is column values generated for which you want the last 5 rows, i.e. how do specify a row in the table to be the last or first.
Thanks
Nimesh |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What is your definition of the "last" row?
In a sequential file, the last record is easily defined, but your questin is not about a sequential file. |
|
Back to top |
|
|
|