Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query
Message
De
23/07/2008 04:12:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/07/2008 00:02:52
Neil Mc Donald
Cencom Systems P/L
The Sun, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01333373
Message ID:
01333394
Vues:
9
This message has been marked as a message which has helped to the initial question of the thread.
>Hi,
> 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


You can use ... < ALL (subquery) construct:
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 < all ;
         (SELECT TOP 1 RTRIM(majver)+[.]+RTRIM(minver)+[.]+RTRIM(midver) ;
                  FROM xmlpackages ;
                  WHERE xmlpackages.pkey between "1000" AND "1999" ;
                  ORDER BY 1 DESC) ;
         AND location.ACTIVE=.T. ;
  ORDER BY location.sitename ;
 INTO CURSOR curLocList
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform