Escolar Documentos
Profissional Documentos
Cultura Documentos
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
USE Terminal1
SELECT F.fl_codiflot, F.fl_nombflot
FROM ( SELECT fl_codiflot, fl_nombflot
FROM Flotas ) AS F
USE Terminal1
SELECT DISTINCT FL.fl_nombflot
FROM Flotas AS FL
WHERE FL.fl_codiflot IN
(SELECT BI.bu_codiflot
FROM Buses AS BI
WHERE FL.fl_codiflot <> BI.bu_codiflot)