Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with HAVING clause
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Problem with HAVING clause
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01196229
Message ID:
01196229
Views:
65
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
Next
Reply
Map
View

Click here to load this message in the networking platform