Select Statement Parameter

Last post 07-01-2009 3:23 PM by Naom. 3 replies.

Sort Posts:

  • Select Statement Parameter

    06-26-2009, 2:01 PM
    • Member
      11 point Member
    • mrgasp07
    • Member since 07-03-2007, 11:46 PM
    • Posts 42

     SELECT DISTINCT [Your Results].sonumber, [Your Results].company, [Your Results].custnumber, [Your Results].sodate, jobdata.dept, jobdata.status, jobdata.ID, jobdata.notes, jobdata.sonumber AS Expr1, [SO total query].SumOfextprice, [Your Results].reqdate

    FROM (([Your Results] INNER JOIN jobdata ON [Your Results].sonumber = jobdata.sonumber) INNER JOIN [SO total query] ON jobdata.sonumber = [SO total query].sonumber)

    ****************************************

    The above statement works fine. I would like to add a parameter to only selects the next req date and not show all the req dates in the gridview for the particular sonumber. Only display one reqdate which should be the soonest date.

    Thanks in advance

  • Re: Select Statement Parameter

    06-26-2009, 4:56 PM
    • All-Star
      29,864 point All-Star
    • Naom
    • Member since 12-31-2007, 2:08 PM
    • Wisconsin
    • Posts 6,659

    Can you list your tables structures? Do you want to get the latest date per SoNumber? Without knowing the details of your problem I can only suggest to review

    http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/the-ten-most-asked-sql-server-questions--1#5 for ideas of how to get the info. This is in SQL Server, but in Access the approach of using derived table is the same.

    Looking for a job opportunity.

    Beware of bugs in the above code; I have only proved it correct, not tried it.
    (Donald Knuth)

    Visit my blog

    PluralSight Learning Library
  • Re: Select Statement Parameter

    07-01-2009, 12:53 PM
    • Member
      11 point Member
    • mrgasp07
    • Member since 07-03-2007, 11:46 PM
    • Posts 42

    SELECT DISTINCT sonumber, reqdate
    FROM         [Your Results]

    sonumber              reqdate

    0001                     06/07/09

    0002                     06/08/09

    0003                     06/09/09

    0003                     06/10/09

    0003                     06/11/09

    I would like it only display the next req date for the sonumber. (Top 1, ASC ????)

    sonumber              reqdate

    0001                     06/07/09

    0002                     06/08/09

    0003                     06/09/09

     

    Thanks in advance

     

  • Re: Select Statement Parameter

    07-01-2009, 3:23 PM
    Answer
    • All-Star
      29,864 point All-Star
    • Naom
    • Member since 12-31-2007, 2:08 PM
    • Wisconsin
    • Posts 6,659

    select SoNumber, min(RegDate) as RegDate from myTable group by SoNumber

    Looking for a job opportunity.

    Beware of bugs in the above code; I have only proved it correct, not tried it.
    (Donald Knuth)

    Visit my blog

    PluralSight Learning Library
Page 1 of 1 (4 items)