Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    7

    Unanswered: question about recent dates

    hello every one
    i have a table with data like tha

    change_date printer_ink old_stock_value new_stock_value
    31/10/2009 1 11 11
    31/10/2009 2 22 23
    01/11/2009 11 0 10
    15/07/2008 15 5 5
    03/11/2009 15 15 43
    01/11/2009 15 5 15
    06/10/2009 15 5 15
    01/11/2009 45 40 84
    14/07/2008 45 28 11


    i want to select printer_ink but only with recent dates like that

    31/10/2009 1 11 11
    31/10/2009 2 22 23
    01/11/2009 11 0 10
    03/11/2009 15 15 43
    01/11/2009 45 40 84

    i tried
    SELECT DISTINCT printer_ink, new_stock_value, change_date
    FROM stock

    but it gives me all the records???
    thanks for help

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Your first step will be to create a query that finds the most recent (or MAX - that's a hint) date per printer_ink.
    We will then decide how best to join that back to the table.

    Have a look here, especially WRT SQL Functions
    SQL Tutorial
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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