Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do avoid getting multiple occurrences
Message
From
04/01/2005 22:22:35
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00974259
Message ID:
00974275
Views:
17
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform