Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with HAVING clause
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Problem with HAVING clause
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01196229
Message ID:
01196229
Vues:
67
Hi Gang!

I am throwing together some SQL, and ran into a snag

I have a table pse_trans with the follwing fields
quan_pur  N 8-3
prod_upc  C-12
trans_dt  DateTime
and a table pse_drug with the following field
upc       C-12
When I run the following code to extract all the records from pse_trans table
that have a certain UPC and within the past 24 hours (86400 seconds)
SELECT SUM(quan_pur) AS Sum24TransUPC, prod_upc FROM pse_trans ;
	GROUP BY prod_upc ;
	HAVING prod_upc = pse_drug.upc ;
		AND trans_dt >= (DATETIME() - 86400) INTO CURSOR TwentyFourHoursQuantUPC
I get an error - 'SQL: Having Clause is Invalid'

When I take the AND trans_dt >= (DATETIME()-86400) out of it, it works without an error.

What is obviously wrong???

Thanks in Advance!!!

Tommy
Tommy Tillman A+ NetWork+ MCP
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform