Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To: Group Data and club a field of the group using S
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00763525
Message ID:
00763623
Views:
63
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform