[RESOLVED] SQL Statement for saleable items
Hi experts!!!!
I have a simple question on sql statement using MS Access query. I want to develop a parameter query that will prompt the user to input for beginning and ending date..Then this query will also display the 5 most saleable products based from the dates inputted.I am developing an inventory database. This query is bound to Order Details table.
Thanks.....
Re: SQL Statement for saleable items
Something like:
SELECT TOP 5 fldProduct FROM [Order Details]
WHERE fldDate >= [Enter start date]
AND fldDate <= [Enter end date]
ORDER BY fldSaleable
You might have to modify this if you're running this in code instead of creating a query in the query pane (for example, surround dates with #'s). It also assumes you have a (probably numeric) field called fldSaleable. Otherwise you'll have to figure out another way to rank saleable products.
The text between the []'s for start and end date will prompt the user for dates (or you could get them from a form instead). The table name is in []'s because it's two words; it's not a parameter.
Re: SQL Statement for saleable items
If you date fields have the time with the date then you need to add 1 day to the EdnDate so it will cover all records up to 11:59 on the desired end date. ;)
Re: SQL Statement for saleable items
Hi Salvelinus, Robdog888 and all the experts...
Please view my attachments regarding sql query. The requirements of the query and a sample table are attached....
Hoping for any answer on this...
:) :) :)
Re: SQL Statement for saleable items
Hi to all!!!
Any ideas on this???
Re: SQL Statement for saleable items
Hi...
I just found a solution....
I used the count function for problem 1 and max function for query 2...
:) :) :)