Example would be, giving back 1% cash to all customers on all orders after their 3rd order. Theoretically, I could send a cheque (check) to them all for all their past custom.
I have:
SELECT mytable.Customerref, Count(mytable.Date) AS CountOfDate, Sum(([GrossSpend]/100)*1) AS [Refund]
FROM mytable
GROUP BY mytable.Customerref;
Which gives ref number, count of date (ie how many times they ordered - in this example they would not order more than once per day), and then the refund (1% of gross order). But I want to ignore completely their 1st two orders.
So, everyone gets 1% on their 3rd, 4th, 5th, xxxth order but not their 1st or second.
Can anyone help with this (probably simple) query. Thanks.
I have:
SELECT mytable.Customerref, Count(mytable.Date) AS CountOfDate, Sum(([GrossSpend]/100)*1) AS [Refund]
FROM mytable
GROUP BY mytable.Customerref;
Which gives ref number, count of date (ie how many times they ordered - in this example they would not order more than once per day), and then the refund (1% of gross order). But I want to ignore completely their 1st two orders.
So, everyone gets 1% on their 3rd, 4th, 5th, xxxth order but not their 1st or second.
Can anyone help with this (probably simple) query. Thanks.