473,382 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to get the last row in the table

Hi,
I need to get a last row from the table. Can anyone assist me.

Regards
Nagendra
Jan 4 '07 #1
2 49496
i2eye
5
It depends on what your table structure is like... say you have a table called table_name, and the identifier is a sequence number called column_id, you can do a subquery... that gets the maximum column_id... then the outer query is to return everything else, see below.


SELECT * FROM table_name WHERE column_id = (
SELECT max(column_id)
FROM table_name );

You may consider looking up Analytical functions as well for a possible solution.
Jan 9 '07 #2
There is somthing called Rowid using which u can select the last record from ur table irrespective of the table structure.


ex: this table contains two records as shown
SQL> select * from sujatha_third;

ROLLNO JOINDATE
---------- ------------------
2 07-DEC-06
1 07-DEC-06

SQL> select * from sujatha_third where rowid=(select max(rowid) from sujatha_third);

ROLLNO JOINDATE
---------- ------------------
1 07-DEC-06


i hope this helps u.
Jan 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Simone Battagliero | last post by:
I wrote a program which inserts and finds elements in an hash table. Each element of the table is a dinamic list, which holds all elements having the same hash value (calculated by an int...
3
by: John Williams | last post by:
I have a HTML page consisting of several tables at the top level of the DOM, interpersed with other HTML tags. For example: HTML BODY -- SCRIPT -- SCRIPT -- #comment -- SCRIPT -- A
5
by: JackM | last post by:
I need a little guidance putting a script together. I'm trying to read a list of image links from a text file (not a database) and display them in a table on my page. I want to display them in rows...
0
by: loga123 | last post by:
Hi All, I am very new to .net and trying to develop a small application. I am using asp .net 2.0. I have a table control (server) in my code that has header row like this. <asp:Table...
9
by: Daniel Kabs | last post by:
Hello there again! On my quest to remove layout tables in favor of CSS controlled elements, I am faced with quite a problem. A table cell that has no explicit width attribute set usually...
0
by: luna | last post by:
In vs.net 2003 I could hide rows in a table with panels (div) eg table table <panel table panel> table worked fine Im trying the same thing in vs.net 2005
1
by: Banyardi | last post by:
How do I determine who last accessed a SQL 2000 table?
2
by: Griff | last post by:
I have a page with multiple tables, some of which have the class "ClassA". I need to identify the widest table whose class is ClassA. The following JavaScript code returns the table width...
2
by: Wally | last post by:
Hi there, One table is corrupted. I found compacting is the cause or triggers the process. I have the solution to repair the wrong records but after each compact the same table is corrupted again...
3
by: SteveP26 | last post by:
Hi guys, I keep getting this error message (below) when I try to run the sql query for my database Heres the code, but the error message only applies to the LAST table (SalesCopy), I have no...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.