Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HAVING Clause in SQL
Message
De
03/07/2003 09:20:07
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
HAVING Clause in SQL
Divers
Thread ID:
00806508
Message ID:
00806508
Vues:
50
Can anyone help me understand what the HAVING clause is doing in this statement?

Thanks! Renoir
SELECT a.*,;
	SUM(IIF(b.acct_id = 0, 1, 0)) cntZERO,;
	SUM(IIF(b.acct_id = 0, b.econ, 0.00)) econZERO,;
	SUM(IIF(b.acct_id = 0, b.emat, 0.00)) ematZERO,;
	SUM(IIF(b.acct_id = 0, b.nProfits, 0.00)) PSZERO,;
	SUM(IIF(b.acct_id <> 0, 1, 0)) cntOTHER,;
	SUM(IIF(b.acct_id <> 0, b.econ, 0.00)) econOTHER,;
	SUM(IIF(b.acct_id <> 0, b.emat, 0.00)) ematOTHER,;
	SUM(IIF(b.acct_id <> 0, b.nProfits, 0.00)) PSOTHER;
	FROM temp1 AS a, acctcont AS b;
	WHERE a.invnum = b.invnum AND a.contrib_dt = b.contrib_dt AND b.transtype = 'T';
	GROUP BY a.invnum, a.contrib_dt;
	HAVING ;
		ABS(econZERO) = ABS(econOTHER) AND ;
		ABS(ematZERO) = ABS(ematOTHER) AND ;
		ABS(PSZERO) = ABS(PSOTHER) ;
		AND cntZERO = cntOTHER;
	INTO TABLE temp
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform