Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query
Message
De
12/08/2003 11:42:25
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00819247
Message ID:
00819402
Vues:
16
Hi Ravi,
* DISTINCT AND GROUP ARE NOT OPTIMIZABLE
SELECT DISTINCT Deptt FROM EmpSalary GROUP BY 1 INTO CURSOR TEMP

* INDEX on Deptt  TAG dtag  && now index is usefull

SELECT TOP 2 Emp_ID ,Emp_Name ,Salary ,Deptt FROM EmpSalary;
  WHERE _TALLY>0 AND Deptt=TEMP.Deptt ORDER BY 3 DESC;
  INTO CURSOR Result READWRITE

SELECT TEMP
SKIP SIGN(_TALLY)
SCAN REST
	INSERT INTO Result;
	SELECT TOP 2 Emp_ID ,Emp_Name ,Salary ,Deptt FROM EmpSalary;
           WHERE Deptt=TEMP.Deptt ORDER BY 3 DESC
ENDSCAN
USE
SELECT Result
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform