0

Hi,

I need to print all the orders with the month in the Monthly Order Report.How should I do it.Can someone tel me how to do it...

This is my query.Order date should equal to the relavent month...

$this->result = mysql_query("SELECT * FROM tbl_order,tbl_order_items WHERE tbl_order.order_id=tbl_order_items.order_id AND tbl_order.order_status='accepted' AND order_date= ............... ORDER BY tbl_order.order_id");

Thanks in advance..:)

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by mwasif
0

The simplest solution looks like the following

$this->result = mysql_query("SELECT * FROM tbl_order,tbl_order_items WHERE tbl_order.order_id=tbl_order_items.order_id AND tbl_order.order_status='accepted' AND MONTH(order_date)=MONTH(NOW()) and YEAR(order_date)=YEAR(NOW())
ORDER BY tbl_order.order_id");

I am assuming order_date is a DATE/DATETIME data type.

Edited by mwasif: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.