Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with HAVING clause
Message
From
15/02/2007 16:10:33
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01196229
Message ID:
01196286
Views:
16
>Hi Gang!
>
>I am throwing together some SQL, and ran into a snag
>
>
>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 see you got answered already, but I'd like to point out something else. DATETIME()-86400 is computing per record. That's slower than you might like. The other thing is datetime() moves forward as the time runs.

I would compute DATETIME() - 86400 to a variable first and then use that variable in the query.
Previous
Reply
Map
View

Click here to load this message in the networking platform