How to create a sub-select in oracle in a table with composite key?

0

The table has composite primary key, and the fields are a date (ID_DEPURACAO) and a number (SEQ_DEPURACAO).

What I want to do is a sub-select that takes only data that is larger than a certain date and has sequences from a certain number.

Here's how I'm trying to do it:

SELECT count (*) from OBJECTEXEMPLO.TABLEEXEMPLO where (id_depuracao> to_date ('26 / 03/2016 ',' dd / mm / yyyy ') and id_depuracao

asked by anonymous 28.10.2016 / 13:44

1 answer

0

Something like

Select *
From tabela t1
Where ...
And data = ( select max(data)
             From tabela t2
             Where t2.chave1 = t1.chave1
             And t2.chave2 = t1.chave2)
    
31.10.2016 / 00:59