>>< snip >>
>>>Hi
>>>I'm afraid it will become too complcated and slow-running query but you caould try somethink like this:
>>>
SELECT t.LotNumber, t.Container, t.Lot_Pieces, t.Lot_Balance FROM MyTable t
>>> WHERE t.LotNumber IN (SELECT top 3 sq.LotNumber, sq.Container, sq.Lot_Balance
>>> FROM MyTable sq
>>> WHERE sq.Container = t.Container )
>>>
>>
>>First, in VFP SELECT TOP n requires ORDER BY clause. Second, such subquery would generate an error.
>
>Sergey, I know ORDER BY requirements and this is just an idea.
>Of course Martin should know how will he order the desired top 3 record (may be on LotNumber)
>I do not have the data to test it.
>Why do you think it will generate an error?
Venelina,
I tried many times to get subquery like that to work w/o any success.
--sb--