no save
Assistance
Achat
News

Forum | programmation
[SQL] requête : obtenir le total
michelatoutfox, le mar. 19 sept. 2006 à 20:46:48
selon la norme SQL92, ta requète devrait s'écrire ainsi:
SELECT Products.ProductName, Products.ProductDesc, Products.type, Stock.Quality, sum(stock.quantity) FROM Products, Stock where Products.ProductName=Stock.ProductName and Products.Type <> 'S'
Group by Products.ProductName, Products.ProductDesc, Products.type, Stock.Quality order by Products.ProductName, Products.Type

en bref, tu as oublié ton champ d'agrégation (le SUM) ; alors sur quoi veux-tu que ton moteur SQL fasse un regroupement (le group by) ?

si possible, préfères une clause JOIN à une clause WHERE, elle sera plus rapide à l'exécution
PrécédentMaxg59
sept. 06
Riwalenn
sept. 06
Suivant
REPONSES
Maxg59
sept. 06
michelatoutfox
sept. 06
Riwalenn
sept. 06
phunk
sept. 06
Riwalenn
sept. 06
Version Web
Réalisé par RedShift
no save