How can I generate a weekly report given an end date and a start date? How should the query be?
I try this one but it's returning an error.
"SELECT * FROM table WHERE date >= startdate AN date<='enddate GROUP BY WEEK BETWEEN startdate AND enddate"

Recommended Answers

All 3 Replies

Something like this... I am not 100% sure, but please try running it on the phpMyAdmin or the command line and see.
The date is a table column.

 $beg_date = '2014-03-01';
 $end_date = '2014-03-07';

"SELECT * FROM YOUR_TABLE_NAME WHERE 'date' BETWEEN $beg_date AND $end_date ";
Member Avatar for diafol

Does it need single quotes around the vars?

oh yeah, @ethan.david.376 please wrap those vars with single quotes. Got carried away with the dumb laws thread at the geek lounge :).

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.