coxdabd — 2011-12-21T07:26:41-05:00 — #1
Hi all, I'm trying to pick my brains on how I can work out a percentage so I would know how many customers are new or returning. I can see customers who have more than one order but not sure how else I can do this, I'm sure it's pretty simple!
SELECT customers_id, customers_name, COUNT(*) AS occur FROM orders GROUP BY customers_id HAVING(occur)>1 ORDER BY occur DESC
r937 — 2011-12-21T08:23:47-05:00 — #2
how do you know a customer is a returning customer?
versus a new customer who places two orders on her first visit?
coxdabd — 2011-12-21T08:27:19-05:00 — #3
Hi, a customer has to firstly create an account and I then store that account number in a column in the order table...
r937 — 2011-12-21T09:42:18-05:00 — #4
when you store that customer number into the first order created by that customer, it's a new customer, right?
and when you store that customer number into the second order created by that customer, it's not a new customer, right?
sounds like you answered your own question