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

no...no es lo que quiero.

la consulta me esta mostrando, un registro por cada ciudad, o sea la fecha, hora y ocurrencia es la misma lo que cambia es la ciudad.

yo quiero que me muestre la fecha, la hora, la ocurrencia, y UNA O VARIAS CIUDADES.


se entiende??? este es el codigo en PHP..


$consulta = "SELECT DISTINCT * 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 ";


$resaviso = mysql_query($consulta,$conex);

if ($resaviso)
{
$Num_filas = mysql_num_rows($resaviso);
$Num_campos = mysql_num_fields($resaviso);

echo "Cantidad de filas: ".$Num_filas."<br>";
//echo "Cantidad de Campos: ".$Num_campos."<br>";


while ($fila = mysql_fetch_array($resaviso))
{


if ($fila['Fecha'] == $hoy)
{
?>

<table width='85%' border='1'>
<tr>
<td><div align='center'><strong>FECHA Y HORA DE EMISION</strong></div></td>
<td><div align='center'><strong>VALIDEZ HASTA</strong></div></td>
</tr>
<tr>
<td><div align='center'><? echo $fila['Fecha']; ?></div></td>
<td> TRES (3) HORAS. posteriores a la emision</td>
</tr>

<tr>
<td><div align='center'><? echo $fila['Hora']; ?> HOA</div></td>
<td>&nbsp; </td>
</tr>
</table>
</td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td><div align='left'><b>POR OCURRENCIA DE:</b><? echo $fila['DescOcurrencia']; ?></div></td>
<td>&nbsp; </td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<? if ($fila['Parcial'] == 'N')
{
?>
<tr>
<td><div align='left'><b>AFECTANDO EL AREA DELIMITADA POR LAS SIGUIENTES LOCALIDADES :</b> <? echo $fila['NomCiudad']; ?>
</div></td><td>&nbsp; </td>
</tr>

<? }else{
?>
<tr>
<td><div align='left'><b>AFECTANDO PARCIALMENTE EL AREA DELIMITADA POR LAS SIGUIENTES LOCALIDADES :</b> <? echo $fila['NomCiudad']; ?>
</div></td><td>&nbsp; </td>
</tr>

<? }
?>



<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td><p><b>---------------------------------------------------------------------------------------------------------------------------------------------------------------</b>-------------------------
</p>
</td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>
</table>
<?