jloyzaga Posted May 25, 2004 Posted May 25, 2004 Below is the query that selects the orders I want to also select on specific manufacturer. This means I need to select the product table using the o.products_id =p.products_id link and then only select on p.manufacturer_id = 1. Can anyone show me the query mods for below?? $sales_query_raw = "select sum(ot.value) gross_sales, monthname(o.date_purchased) row_month, year(o.date_purchased) row_year, month(o.date_purchased) i_month, dayofmonth(o.date_purchased) row_day from " . TABLE_ORDERS . " o left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id) where "; if ($HTTP_GET_VARS['status']) { $status = tep_db_prepare_input($HTTP_GET_VARS['status']); $sales_query_raw .= "o.orders_status =" . $status . " and "; }; $sales_query_raw .= "ot.class = " . $class_val_subtotal; if ($sel_month<>0) $sales_query_raw .= " and month(o.date_purchased) = " . $sel_month; $sales_query_raw .= " group by year(o.date_purchased), month(o.date_purchased)"; if ($sel_month<>0) $sales_query_raw .= ", o.date_purchased"; $sales_query_raw .= " order by o.date_purchased desc"; $sales_query = tep_db_query($sales_query_raw); $num_rows = tep_db_num_rows($sales_query); if ($num_rows==0) echo '<tr><td class="smalltext">' . TEXT_NOTHING_FOUND . '</td></tr>'; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.