Quantcast
Channel: Usando Count na Clausula Where
Viewing all articles
Browse latest Browse all 8

Usando Count na Clausula Where

$
0
0

Bom dia!

Tenho duas tabelas tab1 e tab2

Na tab1 tenho um campo numero
preenchido com um valor (1 ou 2 ou 3 ou 4 ou 5.. até no máximo 10)

Gostaria de Contar na Tab2 os Registros e saber se são iguais, maiores ou menores que o campo numero.

Exemplo:
Select a.numero, b.*
From tab1 a Join tab2 b on a.id = b.tab1_id
Where a.numero < (Select Count(*) From Tab2 c Join Tab2 d on c.id = d.tab1_id)


Maricelmo


Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images