Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Group By
Message
 
To
16/12/2002 14:31:53
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00733350
Message ID:
00733430
Views:
22
I would expect to see
1 Sack and Save Jackson 39185 ATLANTA 12/15/2002
2 Kroger Vicksburg 39180 DALLAS 01/01/2003

Thanks
Donna


>Donna,
>
>Based on your sample datasets, what would be the "two records" that you are expecting to see?
>
>>Sorry Don, that is not distinct by a.fld1, a.flds2
>>
>>Table Dodah
>>A        B
>>1       Sack and Save
>>2       Kroger
>>
>>Table Blah
>>A     C        D
>>1    Jackson   39185
>>2    Vicksburg 39180
>>1    Vicksburg 39182
>>2    Jackson   39184
>>
>>Table Big
>>A     E        F
>>1    ATLANTA   12/15/2002
>>2    DALLAS    01/01/2003
>>
>>That cursor would result in
>>1   Sack and Save   Jackson   39185 ATLANTA 12/15/2002
>>1   Sack and Save   Vicksburg 39182 ATLANTA 12/15/2002
>>2   Kroger          Vicksburg 39180 DALLAS  01/01/2003
>>2   Kroger          Jackson   39184 DALLAS  01/01/2003
>>
>>I need something that would result in two records for this dataset.
>>
>>Donna
>>
>>>Try something like...
>>>
>>>
>>>select distinct;
>>>    a.Fld1,;
>>>    a.Fld2,;
>>>    b.Fld3,;
>>>    c.Fld4,;
>>>    c.Fld5;
>>>  From;
>>>    Dodah a,;
>>>    Blah b,;
>>>    Big c;
>>>  where;
>>>        a.KeyFld1 = b.KeyFld1;
>>>    AND a.KeyFld1 = c.KeyFld1;
>>>  order by;
>>>    a.Fld1,;
>>>    b.Fld3,;
>>>    c.Fld4;
>>>  into;
>>>    cursor C_DistinctSampleSet
>>>
>>>
>>>Your sample fields / tables illustrated ok to some point, but hopefully, you follow the above SQL. I don't know what your REAL join key columns are, but you SHOULD be able to substitute accordingly.
>>>
>>>HTH,
>>>
>>>Don
Donna D. Osburn
www.software-plus.net
Time flies whether you are having fun or not!
Previous
Reply
Map
View

Click here to load this message in the networking platform