Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Help
Message
De
10/08/1999 21:02:32
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
À
10/08/1999 07:48:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00251416
Message ID:
00252313
Vues:
11
I don't know what they'll be, but I pass the group and add it to an array if its not there. I scan the array and return the group no if it is there..... works great....


>Sorry, I thought you wrote that the UDF wouldn't work because you didn't know what the groups would be ahead of time. Glad you solved your problem.
>
>
>>thanks for the input Bill. But I already had used the grouper UDF from the previous suggestion. It works like a charm.
>>
>>
>>>It ain't pretty, but I think this works. You'll need to add housekeeping code.
>>>
>>>* Test is the table you described
>>>
>>>select *, recno() as rec from test into cursor t1 nofilter
>>>index on grp_name to t1 unique
>>>
>>>copy to t2
>>>
>>>select t2.grp_name, t2.rec, test.subseq ;
>>>from t2, test ;
>>>where t2.grp_name = test.grp_name ;
>>>order by rec
>>>
>>>
>>>>Good idea, except that the groups can be anything. They come from a table that can be added to on the fly. I will never no what order the items appear in. Maybe if i use the grouper UDF and build an array as I pass the name in....
>>>>
>>>>Thanks for the idea..
>>>>
>>>>>
>>>>>Don't you just need an ordering field based on Grp_Name?
>>>>>SELECT Grouper(grp_name) AS Grouper, etc. ORDER BY Grouper, Subseq
>>>>>where
>>>>>Grouper is a UDF
>>>>>FUNCTION Grouper
>>>>>LPARAMETER GrpName
>>>>>DO CASE
>>>>>CASE m.GrpName = "input"
>>>>>   RETURN "01"
>>>>>CASE m.GrpName = "cables"
>>>>>   RETURN "02"
>>>>>MORE
>>>>>
>>>>>ENDCASE
>>>>>Charlie
>>>>>
>>>>>>I have a table that contains numerous fields among which are<BR> grp_name and subseq in the following order:
>>>>>>
>>>>>>grp_name     subseq
>>>>>>input          1
>>>>>>cables         2
>>>>>>education      3
>>>>>>cables         4
>>>>>>education      5
>>>>>>cables         6
>>>>>>input          7
>>>>>>
>>>>>>The problem I'm having is that the resulting cursor from the select <BR>must be ordered by grp_name (not alpahbetically but in the order they <BR>appear) and then by subseq in order ie:
>>>>>>
>>>>>>grp_name     subseq
>>>>>>input          1
>>>>>>input          7
>>>>>>cables         2
>>>>>>cables         4
>>>>>>cables         6
>>>>>>education      3
>>>>>>education      5
>>>>>>
>>>>>>I have tried various combinations of Group By and Order By to no <BR>avail.  Any ideas?
>>>>>>
>>>>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform