@:
If the fields type is DATE, then all we have to do is change it to unix timestamp when fetching rows.
Pulling out with datefields is done like this (YYYY-MM-DD):
SELECT * FROM table WHERE UNIX_TIMESTAMP(datefield) >= UNIX_TIMESTAMP('2003-04-03') AND UNIX_TIMESTAMP(datefield) <=UNIX_TIMESTAMP('2003-07-16')
@:
I saw a little bug in my previous query:
and (inf_stamp > UNIX_TIMESTAMP('2003-01-01 00:00:00')
and inf_stamp < UNIX_TIMESTAMP('2003-12-12 23:59:59'))
Should be:
and (inf_stamp >= UNIX_TIMESTAMP('2002-01-01 00:00:00')
and inf_stamp <= UNIX_TIMESTAMP('2003-12-31 23:59:59'))
If you cant get it to work,try first to fetch the rows with no GROUP BY and WHERE quote_type=...:
select id, cust_id, count(price) as num_of_quotes, sum(price) as total from tbl_quote
where inf_stamp >= UNIX_TIMESTAMP('2002-01-01 00:00:00')
and inf_stamp <= UNIX_TIMESTAMP('2003-12-31 23:59:59')
order by total desc limit 25;
Do you get any rows with that?