>>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???
>>
>Why do you need to use pse_drug table here? It could be:
>
>SELECT SUM(quan_pur) AS Sum24TransUPC, prod_upc FROM pse_trans ;
> INTO CURSOR TwentyFourHoursQuantUPC
> Where trans_dt >= (DATETIME() - 86400) ;
> Group by 2
>
Thanks! Sergey just beat you to it!!! I appreciate the help!
Tommy
Tommy Tillman A+ NetWork+ MCP