Having ... doubt!

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc

Poston Mon, 12 Dec 2005 7:00 pm

Guys, good night.
To a cruel doubt and needed an urgent help.

Next, I have to perform a select, let's assume that the table is as follows:
Code: Select all

1   CANAL           1
2   CANAL           1
3   TESTE 3         2
when I give a Group by in select, by type, it returns two rows, for example: 1 TESTE3 2 CHANNEL I wish, in this group by, only to return, the line q scored more quantities, i.e. the channel line is greater (more quantity) that the TEST 3.

Any tips?

Thank you very much.

Cheezburger network: shock:
Location: Araraquara - SP

Poston Tue, 13 Dec 2005 5:10 pm

You can try this:
Code: Select all
select *
  select tipo_produto, count(id)
  from tb_produtos
  group by tipo_produto
  order by 2 desc
where rownum=1
you may be able to do this with analytic functions, which is a lot more scam artist!
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?

Return to PL/SQL

Who is online

Users browsing this forum: No registered users and 7 guests