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..:)

Recommended Answers

All 3 Replies

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.

heyy thanks alot..:)
its working..

You are welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.