Reputation: 649
I have 1 column name: PersonID
it contain name ex john doe
Table name: Person
Column name: PersonID
line1: John Doe
line2: Doe john
now to extract the last line?
this code return number of total line but not text of line
SELECT "PersonID", COUNT(*) FROM "Person";
Upvotes: 0
Views: 1753
Reputation: 311245
Order descending, then use the limit to return the last row -- now in the first position!
SELECT *
FROM Person
ORDER BY PersonId DESC
LIMIT 1
Upvotes: 4