But in my java program i am just passing the table name as parameter to the query to get the latest rows of that particular table
And another problem in my tables is i don't have any auto increment column in my tables to use ORDER BY clause.
SELECT * FROM Person ORDER BY PersonID DESC LIMIT 100
Not sure I understand why this is an issue?
So you have nothing to order this by? In which case what you are trying can't work, unless you add a timestamp or sequential key to your table.
Paul Sturrock wrote:But changing the schema if you need to is the easiest way.
Paul Sturrock wrote:No.
Gopi Chand Maddula wrote:
Paul Sturrock wrote:No.
![]()
![]()
![]()
I think No would not be the answer or suggestion Paul. Anyway thanks for your help throughout the post, but i got the result for the requirement
Here is the simple query i tried for the requirement.
count = select count(*) from table_name;
select * from table_name LIMIT count-100,100
i got the result by using count. It simple returns the last 100 records in the table provided.
Thanks alot guys.
Deepak Bala wrote:
You do of course realize that is not a valid solution ? "select *" in the second query does not order by any column. If you are able to obtain the desired result, it is purely by coincidence.
I think No would not be the answer or suggestion Paul.
Gopi Chand Maddula wrote:...but i got the result for the requirement
Here is the simple query i tried for the requirement.
count = select count(*) from table_name;
select * from table_name LIMIT count-100,100
i got the result by using count. It simple returns the last 100 records in the table provided.
Thanks alot guys.
OCUP UML fundamental and ITIL foundation
OCUP UML fundamental and ITIL foundation
That is different than your original post:Gopi Chand Maddula wrote:...But my requirement is just getting the last 100 rows of the each table and thats it.
I have a Requirement to display the latest 100 rows inserted into the table.
OCUP UML fundamental and ITIL foundation
Jan Cumps wrote:
That is different than your original post:Gopi Chand Maddula wrote:...But my requirement is just getting the last 100 rows of the each table and thats it.
I have a Requirement to display the latest 100 rows inserted into the table.
Is there any big difference between the last and the latest for my scenario???
Please let me know if i miss anything...!
OCUP UML fundamental and ITIL foundation
OCUP UML fundamental and ITIL foundation
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|