
08/03/2013, 18:57
|
| | Fecha de Ingreso: junio-2008
Mensajes: 165
Antigüedad: 16 años, 9 meses Puntos: 6 | |
Respuesta: Group by pero ordenar por fecha Hola Libras, mil gracias por tu ayuda, pero me da errores la consulta:
Mens. 156, Nivel 15, Estado 1, Línea 3
Sintaxis incorrecta cerca de la palabra clave 'GROUP'.
Mens. 156, Nivel 15, Estado 1, Línea 4
Sintaxis incorrecta cerca de la palabra clave 'AS'.
SELECT * FROM(
SELECT * FROM (
SELECT id_material,ubicacion, ISNULL(SUM(cantidad),0) AS total FROM recepcion WHERE id_material = 1 ORDER BY fecha ASC GROUP BY id_material,ubicacion) t1
LEFT JOIN (SELECT max(fecha) max_fecha,ubicacion FROM recepcion GROUP BY recepcion) AS t2 ON (t1.ubicacion=t2.ubicacion) ) t3 ORDER BY max_fecha ASC
Intente ver por qué pero no llego a entender la query :( |