Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible in one SELECT command?
Message
From
02/11/2005 01:38:37
 
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:
01064362
Views:
19
>Fabio
>1) Why no good? Wrong data result or just too "slow"? ( i tested the result with over 100 lines and the data is correct

The time. Run you this in local or net file system?




>2) I understand this code much better than the other one ( in fact now i understand what you did there ). I'll run it too and compare the 2 resulting mytesttable to see if there is any difference.

You tries the underlying code
(I have extracted the inside query and produced the group's row numbers
with a single replace,
the COUNT(*) it has to make a Cartesian product of the filtered data).
This code doesn't depend on the selectivity of the filter,
and you can organize all the 250000 patients in few seconds.


>
>Molto grazzie
>Jaime
>
>>>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