Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/02/2006, 06:58
amontagnaro
 
Fecha de Ingreso: febrero-2004
Mensajes: 65
Antigüedad: 20 años, 2 meses
Puntos: 0
Select y distinct

tengo esta consulta:


$consulta = "SELECT * FROM
TAviso a INNER JOIN (TAvisoSeleccion b, TAvisoOcurrencia c,TAvisoCiudad d)
ON (a.IdAlerta = b.IdAlerta AND a.IdOcurrencia=c.IdOcurrencia AND d.IdCiudadAlerta = b.IdCiudadAlerta)
WHERE TIME(DATE_SUB(NOW(), INTERVAL 6 HOUR)) <= a.Hora ";


este es el resultado:


IdAlerta Fecha Hora IdOcurrencia Parcial IdAlerta IdCiudadAlerta IdOcurrencia DescOcurrencia IdCiudadAlerta NomCiudad
20 2006-02-16 14:30:00 6 N 20 3 6 Vientos Fuertes 3 Acebal
20 2006-02-16 14:30:00 6 N 20 4 6 Vientos Fuertes 4 Alvarez
19 2006-02-15 07:43:00 5 N 19 0 5 Lluvias Intensas con Ráfagas 0 25 de Mayo
19 2006-02-15 07:43:00 5 N 19 1 5 Lluvias Intensas con Ráfagas 1 9 de Julio
19 2006-02-15 07:43:00 5 N 19 3 5 Lluvias Intensas con Ráfagas 3 Acebal
18 2006-02-15 13:40:00 4 Y 18 2 4 Lluvias Intensas 2 Abasto
18 2006-02-15 13:40:00 4 Y 18 3 4 Lluvias Intensas 3 Acebal

y lo muestra asi:


FECHA Y HORA DE EMISION
2006-02-16
14:30:00

POR OCURRENCIA DE:Vientos Fuertes
AFECTANDO EL AREA DELIMITADA POR LAS SIGUIENTES LOCALIDADES : Acebal

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FECHA Y HORA DE EMISION
2006-02-16
14:30:00

POR OCURRENCIA DE:Vientos Fuertes
AFECTANDO EL AREA DELIMITADA POR LAS SIGUIENTES LOCALIDADES : Alvarez


y yo lo que quiero es que no me muestre todos los registros repetidos,
que si las ciudades son distintas me la muestre en un solo registro.
quedando asi:

FECHA Y HORA DE EMISION
2006-02-16
14:30:00

POR OCURRENCIA DE:Vientos Fuertes
AFECTANDO EL AREA DELIMITADA POR LAS SIGUIENTES LOCALIDADES : Acebal, Alvarez


uso Distict, pero no se como utilizarlo, alguien me podria explicar??

gracias