Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- email address|product code
- garry123@gmail.com |A123A
- garry123@gmail.com |AB263
- ada121@hotmail.com |45632A
- ada121@hotmail.com |78YU
- garry123@gmail.com |6543D
- garry123@gmail.com|A123A,AB263,6543D
- ada121@hotmail.com|45632A,78YU
- SELECT
- c.EmailAddress,
- od.concat(productcode) as Product_SKU
- FROM
- OrderDetails od
- JOIN Orders o
- ON od.OrderID = o.OrderID
- JOIN Customers c
- ON c.CustomerID=o.CustomerID
- WHERE
- o.OrderDate BETWEEN 01/01/2016 AND getdate()
- GROUP BY c.EmailAddress
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement