If you need to do it in pure SQL, I don't know how to help you. You'd probably need to write an iterator in T-SQL.
In CF, you could grab each half-hour by using a 'between' argument in your where clause. Does that help at all? --Ben Won Lee wrote: > Hi, > > I need to write a quick SQL script and having some problems. > > I have a table in MS-SQL: > > TradeData > ========== > TradeID BIGINT > EquityID BIGINT > TradeTime smalldatetime > Volume integer > Price money > > The purpose of this table is to store the data for day of each stock in > 5 minute intervals. For example, if MSFT is EquityID 1, then the row > would look like this. > > 46913655 13280 2004-10-04 00:00:00.000 1900-01-01 09:30:00.000 132800 > 23.5900 > 46913656 13280 2004-10-04 00:00:00.000 1900-01-01 09:35:00.000 56600 > 23.4800 > 46913657 13280 2004-10-04 00:00:00.000 1900-01-01 09:40:00.000 37300 > 23.3500 > 46913658 13280 2004-10-04 00:00:00.000 1900-01-01 09:45:00.000 62900 > 23.3900 > > etc > > You can see that the day is split up into 5 minute intervals. Wondering > how I could group into x intervals , where x > 5. IE break down the > trading day into 30 minute intervals. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:5:135098 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
