SQL Scripts Help

  • Hi Kenneth

    Thanks for your Help but

     

    Invoice No    Ref No  

    OP/I2002     T13711  

    Stock Movement History  Table

    Warehouse Date  Parent  Child Key

    D2  21/05/2003 P08183     P08183   

    D2  11/08/2003 T13711     P08183   

    AB  11/08/2003 T13711     T13711   

    My Required result is

    D2  21/05/2003 P08183     P08183    

    Kind Regards

    Vijay

     

  • Assuming that's all you want ...

    SELECT MIN([DATE]) FROM STOCK_MOVEMENT_HISTORY

    If you actually want more than that, please post an example of your required results.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Well, what do you want to do? You have several rows that will match for minimum date on both your Ref_no examples...

    /Kenneth

  • Does this work?

    SELECT *

    FROM [Stock Movement History]

    WHERE [Date] = (SELECT MIN([Date])

    FROM [Stock Movement History])

    -SQLBill

  • Hi SQLBill

    Thanks for your reply

    I need to link with Invoice Master file and I get the stockmovement Min Date

    Invoice No    Ref No 

    OP/I2002     T13711 

                         child        Parent

    D2  21/05/2003 P08183     P08183   

    D2  11/08/2003 T13711     P08183   

    AB  11/08/2003 T13711     T13711   

    Result will be

    D2  21/05/2003 P08183     P08183 

    Kind Regards

    Vijay

  • Vijay,

    I only see one table being shown, so that's all I can work with to provide an answer.

    You need to provide what tables you have, what columns are in the tables and sample data.

    -SQLBill

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply