problem with sql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ada¶

    #1

    problem with sql

    Hello to everyone,

    In my own database, I linked customers table with orders table using
    one-to-many relation. I need to check status of last order for each
    customer and then set customer's status. I made a query using LAST and
    GROUP BY to select last order for each customer and I wanted to use it
    in UPDATE query, but it seems to be impossible. Is here anybody who
    knows how to solve this problem? (I work with MS Access).

    Adam

  • Larry  Linson

    #2
    Re: problem with sql

    Last picks the value from the last record in the grouping, which because the
    records are unordered if you don't specify, may not be the most recent date.
    It does not, repeat NOT, select the last record but only that one column's
    value from the last record.

    To get the most recent value, on the pertinent date field, choose OrderBy,
    Ascending, and use Last on all the Columns for which you want data from the
    most recent record.

    "Ada¶" <adamn@qwe.pl > wrote in message
    news:Ojzkb.2514 6$bU3.325187@ne ws.chello.at...[color=blue]
    > Hello to everyone,
    >
    > In my own database, I linked customers table with orders table using
    > one-to-many relation. I need to check status of last order for each
    > customer and then set customer's status. I made a query using LAST and
    > GROUP BY to select last order for each customer and I wanted to use it
    > in UPDATE query, but it seems to be impossible. Is here anybody who
    > knows how to solve this problem? (I work with MS Access).
    >
    > Adam
    >[/color]


    Comment

    Working...