Sergey --
Well, gosh, that's simple ... Thanks very much / Jim
>Hi Jim,
>
>Try
SELECT DISTINCT soshipline.invtid as Partno
>...
>
>>I have a fairly simple SQL statement (below) which is causing me one problem. I'm attempting to retrieve 'soshipheader.custid' (customer id), and there can be multiple matching records in 'soshipheader' based on my criteria (all with the same value for 'custid'), so I end up getting multiple groups of records for everything from 'soshipline'.
>>
>>All I'm really looking for here is the 'custid' from the FIRST matching record in 'soshipheader'. Is it possible to do that?
>>
>>
>> SELECT soshipline.invtid as Partno
>> , soshipline.qtypick
>> , soshipline.qtyship
>> , soshipline.ordnbr
>> , soshipline.siteid
>> , soshipline.slsprice
>> , soshipheader.custid
>> FROM soshipline, soshipheader, inventory
>> WHERE inventory.invtid = soshipline.invtid
>> AND soshipline.ordnbr = soshipheader.ordnbr
>> AND inventory.transtatuscode <> 'in'
>> AND soshipline.status = 'O'
>> AND soshipline.qtypick <> '0'
>> AND soshipheader.status = 'O'
>> AND soshipheader.sotypeid not in ('ka','tr')
>>
Jim Nelson
Newbury Park, CA