I'm being trained in database management and this is my first post ever, so I apologize if I don't follow a standard procedure in posting. I have searched and just can't find an answer.
In PostgreSQL, I'm trying to find all new customer orders in 2014. But some customers may have been added in 2013 or 2012, but didn't make their order until 2014. So I'm trying to query where Customers do not have an order before 1/1/2014, or in other words, their first order is after 12/31/2013.
I know this only shows new customers added in 2014, I just need to somehow grab the ones added before that.
SELECT DISTINCT cust_name, COUNT (cust_name) FROM cohead JOIN custinfo ON cust_id=cohead_cust_id WHERE cust_dateadded >='1/1/2014' AND cust_dateadded <='12/31/2014' AND cohead_orderdate >='1/1/2014' AND cohead_orderdate <='12/31/2014' GROUP BY cust_name ORDER BY cust_name