Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To: Group Data and club a field of the group using S
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00763525
Message ID:
00763623
Vues:
62
This message has been marked as the solution to the initial question of the thread.
>Hi all
>
>This is a typicaly requirement that I have. I have a table having values as below:
>
>HB         Haematology
>TC         Haematology
>URM        UrineAnalysis
>DC         Haematology
>
>
>I can group the above like follows:
>
SELECT * FROM ... GROUP BY 2
>
>but I want the following result in the result:
>
>HB TC DC     Haematology
>URM          UrineAnalysis
>
>
>Is this possible to display in a view. This view will then be used externally by Report Manager for printing purposes. Thus I have to already have formatted the data beforehand as Report Manager won't be able to call VFP UDFs.
>
>Please help.

I don't think you can do this w/o UDF's.
SELECT Test0.ln, combinesn(ln) AS snlist;
 FROM ;
     test0;
 GROUP BY Test0.ln

...
FUNCTION combinesn
LPARAMETERS lcLn
LOCAL laList[1], lcStr, i
SELECT sn FROM test0 ;
	WHERE ln = lcLn ;
	INTO ARRAY laList
	
lcStr = ""	
FOR i=1 TO _TALLY
	lcStr = lcStr + " " + laList[i]
ENDFOR
RETURN PADR(lcStr,32)
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform