Benchenko Posted February 10, 2015 Share Posted February 10, 2015 Hi, I am trying to show a list of accounts where 2 identical products, have been ordered for the same account, within the same calendar month. Field names: A/c number, Order id, Cust name, Product, Purchase date I have used GROUP BY and HAVING, but I am concerned with the volume of records returned. Any help, please? Thank you Link to comment Share on other sites More sharing options...
justsomeguy Posted February 10, 2015 Share Posted February 10, 2015 Group by would be correct, you'll need to use a function to return the month and year only of the date, and group by that value plus the account, plus the product. You can use having to filter out anything with only 1 record. What query are you using now? Link to comment Share on other sites More sharing options...
Benchenko Posted February 11, 2015 Author Share Posted February 11, 2015 Thanks - I was correct with my original query. I tested the HAVING clause with different values, in order to check and test the data against what was stored in the relevant tables. Link to comment Share on other sites More sharing options...
funbinod Posted February 13, 2015 Share Posted February 13, 2015 can u post ur query that u tried? how can anyone suggest u anything without seeing what have u done? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now