THE SQL CHALLENGE!

From: Patrick S Hart <phart_at_magnus.acs.ohio-state.edu>
Date: 2 Sep 1994 13:22:14 GMT
Message-ID: <3478u6$lit_at_charm.magnus.acs.ohio-state.edu>


Hi Folks!

I have been trying, to no avail, to solve the below problem with only one pass at the data. I was curious to know if anyone can solve this:

Table Definition:

   StockNumber Product LastInvDate LastInvQty


    NSN4567          Shoes           08/12/94       1,000
    NSN4567          Shoes           09/01/94       1,500
    NSN2345          Pants           08/23/94       1,200
    NSN2345          Pants           08/05/94       1,500


I want to select the *last* recorded Inventory for a given date. So if the date
given is 09/02/94, the result should look like this:

    NSN4567          Shoes           09/01/94       1,500
    NSN2345          Pants           08/23/94       1,200

I have not been able to do this in one pass. Anybody know how???

Many Thanxs,
P. Received on Fri Sep 02 1994 - 15:22:14 CEST

Original text of this message