MySQL DATE_ADD usage, 5 day interval
- by Webnet
I'm trying to select the order total sum ($) and invoice count over a 5 day period in a single query. I can't seem to get this to happen though. The current query I have is here...
SELECT
COUNT(id) as invoice_count,
SUM(orderTotal) as orders_sum,
UNIX_TIMESTAMP(created) as created
FROM ids_invoice
WHERE DATE_ADD(created, INTERVAL +1 DAY)
AND userId = '.$userId.$whereSql
I'm not entirely sure DATE_ADD is the right function I'm looking for
I'm fairly new to mysql date functions so perhaps I just missed the function I needed when going through mysql docs.