PHP - Una ayuda por favor

 
Vista:

Una ayuda por favor

Publicado por ADRIAN (6 intervenciones) el 28/05/2007 18:22:36
Gracias por consultar mi solicitud, les agradeceria mucho que me indicaran como puedo agregar un segundo dato a mi consulta ya que genero lo siguiente:

Cliente1 Suma_total_ventas_enero
Cliente 2 Suma_total_ventas_enero
etc.

Y quiero aumentarla a lo siguiente (Suma_total_ventas_febrero):

Cliente1 Suma_total_ventas_enero Suma_total_ventas_febrero
Cliente 2 Suma_total_ventas_enero Suma_total_ventas_febrero
etc.

Pero no encuentro como hacerlo, tengo lo siguiente y espero alguien pueda ayudarme.

mysql_select_db($database_estadistico, $estadistico);
$query_gral = sprintf("SELECT ncli, fchfac, Sum(tarifa), NOMCL FROM mofacd INNER JOIN clfil ON clfil.NCL=mofacd.ncli WHERE fchfac BETWEEN '2007/01/01' AND '2007/01/31' GROUP BY (ncli) ORDER BY Sum(tarifa) DESC", $varIni_gral,$varFin_gral);
$query_limit_gral = sprintf("%s LIMIT %d, %d", $query_gral, $startRow_gral, $maxRows_gral);
$gral = mysql_query($query_limit_gral, $estadistico) or die(mysql_error());
$row_gral = mysql_fetch_assoc($gral);

if (isset($_GET['totalRows_gral'])) {
$totalRows_gral = $_GET['totalRows_gral'];
} else {
$all_gral = mysql_query($query_gral);
$totalRows_gral = mysql_num_rows($all_gral);
}
$totalPages_gral = ceil($totalRows_gral/$maxRows_gral)-1;

$queryString_gral = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_gral") == false &&
stristr($param, "totalRows_gral") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_gral = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_gral = sprintf("&totalRows_gral=%d%s", $totalRows_gral, $queryString_gral);

do {

echo $row_gral['ncli'];
echo $row_gral['NOMCL'];
echo "$". number_format($row_gral['Sum(tarifa)'],"2",".",",");
} while ($row_gral = mysql_fetch_assoc($gral));
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder