MySQL Forums
Forum List  »  Spanish

Re: El MENOR/MAYOR de un GRUPO de filas
Posted by: Jesús Uzcanga
Date: August 23, 2013 03:29PM

Marco. Siempre es bueno que agregues el script con el CREATE TABLE y el INSERT INTO para poder ayudarte.

El código es el siguiente:

SELECT contrato,hotel,temporada,MIN(tarifa) FROM contratos
GROUP BY hotel,temporada
ORDER BY hotel,temporada

Explicado, debes solicitar el MIN(tarifa) y agrupar por los campos que segmentan la consulta... Para que muestre el resto de los datos puedes acompañar el MIN() o cualquier otra función de agrupación junto con otros campos de la tabla.

___________________________
Ing. Jesús Alfredo Uzcanga
Twitter: @JesusUzcanga

We learn the 20% of what we HEAR,
the 50% of what we SEE,
the 80% of what we DO and
the 95% of what we TEACH.

____________________________________________________________
https://www.linkedin.com/in/jauzcanga/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: El MENOR/MAYOR de un GRUPO de filas
1068
August 23, 2013 03:29PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.