filters

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 11 Dec 2007 2:20 pm

Hello I have a select the Bank that seeks the following
Code: Select all
select p.nome, c.tipo_de_carro

from carros c, pessoa p

where p.cdpessoa = c.cdcarro
here I wanted to do my research bringing only those containing cars audi and monza cannot bring audi separated and monza only has to bring separated people who have both together
carlos12
Location: rio

Poston Tue, 11 Dec 2007 3:12 pm

Hey Carlos, beleza?

man, of a look at it, see if it helps.

Code: Select all
SELECT   COUNT (b.codigo) qt,
         a.nome
    FROM pessoa a,
         carro  b
   WHERE a.id_carro = b.codigo
     AND b.marca IN ('AUDI', 'MONZA')
GROUP BY a.nome
  HAVING COUNT (b.codigo) > 1


[]s!!
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Wed, 12 Dec 2007 6:35 am

valeu guy gave right the way I wanted to, I owe you that, yesterday I couldn't post the thanks porque, was garrado same, but thank you
carlos12
Location: rio



Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests