Answer by Akina for MySQL Conditional Counter Based Other Columns?
SELECT t.*, CASE WHEN CONCAT(t.CustomerName, CHAR(0), t.PurchaseDate) = @group THEN @num:=@num+1 ELSE @num:=1 END PurchaseNumberForDate,@group:=CONCAT(t.CustomerName, CHAR(0), t.PurchaseDate)...
View ArticleMySQL Conditional Counter Based Other Columns?
I have a query that returns purchases for all customers in a store across a date range. It works fine, but now I've been asked to modify the results so only the first purchase per customer per day is...
View Article
More Pages to Explore .....