Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda