![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
04/08/2009, 13:20
|
| | Fecha de Ingreso: julio-2009 Ubicación: .mysql_error ( XD )
Mensajes: 554
Antigüedad: 15 años, 7 meses Puntos: 13 | |
Cómo unir 2 consultas? Tengo que hacer 2 consultas para poder mostrar información en una tabla, pero no sé como unirlas y que funcione, porque lo que he intentado no me funciona.
la consulta principal que tengo es: Código PHP: $consul = "SELECT * FROM valorreal
INNER JOIN valoracumulado ON valorreal.categorias = valoracumulado.categorias
AND valorreal.ano = valoracumulado.ano
AND valorreal.mes = valoracumulado.mes
AND valorreal.tipo = valoracumulado.tipo
WHERE valorreal.ano='$anio' AND valorreal.mes='$mess' AND valorreal.tipo='asdf'";
$resul = mysql_query ($consul) or die ("Error en consulta:".mysql_error());
while ($filas = mysql_fetch_array($resul)) {
y tengo que agregarle esta: Código PHP: SELECT * FROM categorias WHERE nombre='asdf'
desde ya muchas gracias! |