MySQL DATE_ADD usage, 5 day interval
Posted
by Webnet
on Stack Overflow
See other posts from Stack Overflow
or by Webnet
Published on 2010-04-21T15:59:33Z
Indexed on
2010/04/21
16:03 UTC
Read the original article
Hit count: 164
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.
© Stack Overflow or respective owner