MySQL Forums
Forum List  »  MySQL Query Browser

Need help with measuring ave sales in specific period
Posted by: Paolo C
Date: November 14, 2010 04:40AM

Hello, I have transactional data and wish to measure average sales from specific time interval. My data looks like this:
ID, Timestamp, sales
1,2010-11-14 08:50:00, 50
2,2010-11-13 09:50:00, 20
etc,

I would like to measure average sales from 13:00 to 15:00 for the last 30 days, I figure I need to use subqueries but I am stuck at this query below. I can't use the alias I created to split the timestamp variable (note a month of data is about 10000 records). Your help is appreciated...

SELECT CAST(s_date AS DATE) AS t_date, CAST(s_date AS TIME) AS t_Time,sales
FROM intradaydata
WHERE ID = 65 and t_Time >= '13:00:00' and t_Time <= '15:00:00'
ORDER BY s_Date DESC
LIMIT 10000;



Edited 2 time(s). Last edit at 11/14/2010 04:47AM by Paolo C.

Options: ReplyQuote


Subject
Written By
Posted
Need help with measuring ave sales in specific period
November 14, 2010 04:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.