Académique Documents
Professionnel Documents
Culture Documents
Fecha:
INFORMACION
octubre/2010
Lenguaje SQL - Subconsultas
use Northwind
select distinct od.ProductID
from [Order Details] od
where od.ProductID in (select od.ProductID from [Order Details] ods
where od.UnitPrice <> ods.UnitPrice) group by od.ProductID having
COUNT(od.ProductID) > 20
order by od.ProductID
use Northwind
select distinct od.ProductID, ProductName
from [Order Details] od inner join Products p on od.ProductID = p.ProductID
where od.ProductID in (select od.ProductID from [Order Details] ods
where od.UnitPrice <> ods.UnitPrice) group by od.ProductID, ProductName
having COUNT(od.ProductID) > 20
order by od.ProductID, ProductName