Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
select all rows after specific uuid in postgresql

I want to select all rows starting after a specific uuid, for example here is the data

+--------------------------------------+-----------+------------+
|                 uuid                 | divisi_id | divisionid |
+--------------------------------------+-----------+------------+
| b303a96b-2a03-4b5e-90a1-6b3631fc82af | BTT       |          3 |
| 8c4bf1b8-7477-42e4-affb-31bafa8648f1 | BTT       |          3 |
| 6639909d-74e1-4dec-a1f3-f70703c0b6c6 | BTT       |          3 |
| 1a1aa367-1467-4811-848d-694dbe98a5a8 | BTT       |          3 |
| e739b352-d952-4ec8-980e-a50180e18144 | BTT       |          3 |
+--------------------------------------+-----------+------------+

now, for example I have last uuid = 8c4bf1b8-7477-42e4-affb-31bafa8648f1 (the 2nd entry). how to select rows after that uuid? i have no idea about it.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try this

SELECT d1.* FROM
(SELECT Row_Number() over (order by id) AS RowIndex, * from tableName ) AS d1 
INNER JOIN 
(SELECT Row_Number() over (order by id) AS RowIndex, * from tableName) AS d2 
ON (d2.uuid  = '8c4bf1b8-7477-42e4-affb-31bafa8648f1' and d1.RowIndex > d2.RowIndex)

Hope you have primary key!!

If you don't have Primary key than

SELECT d1.* FROM
(SELECT Row_Number() over (order by (select null)) AS RowIndex, * from tableName) AS d1 
INNER JOIN 
(SELECT Row_Number() over (order by (select null)) AS RowIndex, * from tableName) AS d2 
ON (d2.uuid  = '8c4bf1b8-7477-42e4-affb-31bafa8648f1' and d1.RowIndex > d2.RowIndex)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!