Thanks, Sergey.
I appreciate it!
Tommy
>"trans_dt >= (DATETIME() - 86400)" belongs in the WHERE clause because it's not in the result set. I'm not sure why do you need HAVING at all. The WHERE shiould do.
>
>>
>>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