Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Query
Message
From
23/07/2008 20:02:49
Neil Mc Donald
Cencom Systems P/L
The Sun, Australia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01333373
Message ID:
01333599
Views:
7
Thanks Sergey,

I had tried the MAX() function but couldn't get it right, thanks again.

>Neil,
>
>Try
>
>SELECT xmlpackages.pkey, location.siteid AS Site, location.sitename AS NAME, location.phone, ;
>    location.contype AS contype, location.exevers AS ExeVersion, ;
>    COUNT(clients.clientno) AS Qty ;
>  FROM location ;
>  JOIN clients ON clients.siteid=location.siteid ;
>  WHERE location.exevers < ;
>         (SELECT MAX(RTRIM(majver)+[.]+RTRIM(minver)+[.]+RTRIM(midver)) ;
>                  FROM xmlpackages ;
>                  WHERE xmlpackages.pkey between "1000" AND "1999" )
>         AND location.ACTIVE ;
>  GROUP BY location.siteid, location.sitename, location.phone,  location.contype, location.exevers ;
>  ORDER BY location.sitename ;
> INTO CURSOR curLocList
>
>> Can this be done in one SELECT statement:-
>>
>>
>>SELECT ALLTRIM(majver)+[.]+ALLTRIM(minver)+[.]+ALLTRIM(midver) as version ;
>>TOP 1 ;
>>FROM xmlpackages ;
>>WHERE BETWEEN(xmlpackages.pkey,"1000","1999") ;
>>ORDER BY 1 DESC INTO CURSOR curSelect nofilter
>>
>>SELECT curSelect
>>
>>SELECT xmlpackages.pkey, location.siteid AS Site, location.sitename AS NAME, location.phone, ;
>>	location.contype AS contype, location.exevers AS ExeVersion, ;
>>	COUNT(clients.clientno) AS Qty ;
>>	FROM location ;
>>	JOIN clients ON clients.siteid=location.siteid ;
>>	GROUP BY location.siteid, location.sitename, location.phone, ;
>>	location.contype, location.exevers ;
>>	WHERE location.exevers < curSelect.version AND location.ACTIVE=.T. ;
>>	ORDER BY location.sitename ;
>>	INTO CURSOR curLocList
>>
>>
>>Thanks in advance
Regards N Mc Donald
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform