Results 1 to 6 of 6

Thread: [RESOLVED] SQL Statement for saleable items

  1. #1

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Resolved [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.....

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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.
    Tengo mas preguntas que contestas

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    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...


  5. #5

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: SQL Statement for saleable items

    Hi to all!!!

    Any ideas on this???

  6. #6

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    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...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width