Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible in one SELECT command?
Message
From
01/11/2005 05:58:55
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01063783
Message ID:
01063944
Views:
13
>Bingo!!
>This one works perfectly, and in 1.82 seconds by the way.
>A million thanks again, Fabio
>Jaime
>
NO GOOD.

TRY
* phase 1 : grouping info
SELECT  ;
	DOW(Date)	dateW		;
,				Shaa		;
,				PCode		;
,	Oper		rowGroupNum	;	&& Oper must to be a INTEGER
	INTO CURSOR tempPhase1 READWRITE;
	FROM Yoman	;
	ORDER BY 1,2 
 &&	WHERE Date between m.lStartDate AND m.lStartDate+3 AND  Bit NOT IN ("ì", "ð", "á" )	AND	m.RofeCode IN (  M1,  M2,  M3,  M4 )

* this numbers the rows of every group
PRIVATE dateW,Shaa
DO WHILE NOT EOF()
	SCATTER FIELDS dateW,Shaa MEMVAR 
	REPLACE WHILE dateW=m.dateW AND CTime==m.Shaa rowGroupNum WITH _TALLY
ENDDO
RELEASE dateW,Shaa

* final group transposition
SELECT T.Shaa	;
,  MAX( IIF(dateW=1, Patient.Shem+Sug+left(NVL(SugTip.SugTipul,"  "),2) ,SPACE(28))) AS Sunday ;
,  MAX( IIF(dateW=2, Patient.Shem+Sug+left(NVL(SugTip.SugTipul,"  "),2) ,SPACE(28))) AS Monday;
,  MAX( IIF(dateW=3, Patient.Shem+Sug+left(NVL(SugTip.SugTipul,"  "),2) ,SPACE(28))) AS Tuesday ;
,  MAX( IIF(dateW=4, Patient.Shem+Sug+left(NVL(SugTip.SugTipul,"  "),2) ,SPACE(28))) AS Wednesday ;
FROM tempPhase1 T;
LEFT JOIN Patient ON T.PCode=Patient.Code ;
LEFT JOIN Sugtip  ON T.Tipul=SugTip.Code ;
GROUP BY Shaa , rowGroupNum ;
INTO TABLE mytesttable
USE IN tempPhase1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform