Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select with count included to get a certain qty
Message
De
02/02/2006 13:13:24
 
 
À
02/02/2006 11:08:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01092895
Message ID:
01092990
Vues:
19
This message has been marked as the solution to the initial question of the thread.
>Hi all, i need an sql to get the list of items that have 2 or more price but not wich have only 1 price. I'm doing this: select i.code,i.name,l.vendor,l.price from list,item where i.code=l.code , this sql returns all items with all prices in list but i need only the items that have more than 1 record in list, so i make another sql to have the code: select code,count(1) as total from query, next i get the code for total=1 and delete them in first sql. There is a way to doit with just 1 line in sql?
>
>Thanks in advance,

How about
SELECT item.code,item.name,list.price FROM item , list;
WHERE item.code = list.code;
  AND list.code IN (SELECT code FROM list GROUP BY code HAVING COUNT(*) > 1)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform