-1
returns a row and how many times it occurs (SQL Para Contar Se for Maior Que 1)
SELECT *,
count(*) AS c
FROM ITENS_VENDA
GROUP BY SEQ_VENDA
HAVING c > 1
ORDER BY c DESC
If you want the complete lines
select * from ITENS_VENDA where SEQ_VENDA in (
select SEQ_VENDA from ITENS_VENDA
group by SEQ_VENDA having count(*) > 1
)
Table example
Upshot
What do you mean as referent? and "if SEQ_VENDA has more than 001 NUMERO". Could you explain better?
– Rodrigo Rocha
The number is a straight sequence? and the Seq_sale is the sequence of the sale, if the sale has only 1 item, it is not to bring anything, but if the sale has 2 items, the NUMBER will be 001 and 002 and then yes, bring the data.
– Marcos Correia