Advertisement
Fhernd

Consulta9.sql

Sep 5th, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT nombre
  2. FROM
  3. (SELECT COUNT(*) AS NUMEROAPERITIVOS, ID_BAR
  4. FROM
  5. (SELECT *
  6. FROM
  7. (SELECT B.ID , B.Nombre AS NombreBebida, T.Nombre AS NombreTipo  FROM (Parranderos.BEBIDAS B INNER JOIN Parranderos.TIPO_BEBIDA T ON B.ID=T.ID)) Tipos INNER JOIN PARRANDEROS.sirven S  ON Tipos.ID=S.ID_BEBIDA)Toda
  8. WHERE Toda.HORARIO = 'diurno' AND Toda.NOMBRETIPO='aperitivo'
  9. GROUP BY Toda.ID_BAR)num_aperitivos
  10. INNER JOIN Parranderos.Bares X ON num_aperitivos.ID_BAR =X.ID
  11. WHERE PRESUPUESTO='Alto' AND NUMEROAPERITIVOS BETWEEN 3 AND 7
  12. ORDER BY numeroaperitivos, nombre
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement