Unknown column in 'group statement'

Good morning,

I am trying to pull records from a table that has new records created every few seconds, and generate a summary of those records by 15 minute intervals. Of note, I’m pulling off a backup MySql database, and am using Scriptcase version 7.01.0020. If I run the following query in MySql (actually I use the Webmin MySql interface), it works fine.


SELECT Date, sec_to_time(time_to_sec(Time)- time_to_sec(Time)%(15*60)) as TimePrd, sum(PostTime) as Post_Time, sum(Wait)/sum(Inbound_Act) as Avg_Wait from Calculated_Stats
WHERE Date > current_date - 2
group by TimePrd

But when I copy/paste it into the creation of a grid, and run the grid, I get the error below:


Error
Error while accessing the database:
Unknown column ‘TimePrd’ in ‘group statement’
select count(*) from Calculated_CallStats where Date > current_date - 2 group by TimePrd

Can anyone tell me what I’m doing wrong? Ultimately I want to use the resulting data to create daily graphs of Post_Time and Avg_Wait for each 15 min TimePrd.
Thanks in advance for any help or suggestions!

Mark.

If you need your report using group-by then I know there are group-by option to set within the grid. So it might run into conflict there, not sure. But I think it might be an option to look at these options as you can also calculate groups and totals.

Ok, thanks Albert - guess I was going about it the hard way =) I’ll give that a shot - thanks for the help!

Mark.