Hi everyone! It's my first time on this forum, so I hope I'm posting in the correct place for my question (it seems to be since I'm using DB2). My question pertains to SQL and has been perplexing me as I am relatively new to non-trivial (at least to me) queries.
The problem: I have the following table
Code:
stocks {
symbol string
shares integer
price float
time integer (this is in hhmmss format..1:59:43 AM is written 005943)
}
And I want to use this data to create this table:
Code:
avgprice {
symbol string
interval integer (this is summarized to 0= 12 AM to 12:59:59 and so on...)
avgprice float
}
My two questions are: Can I use the timestamp feature of DB2 to work with the integer in the format of hhmmss (I don't believe I can, but I was just wondering). If not, what is an easy way for me to correlate 000000-005959 to 0 in the avgprice table?(I want to pull out the leftmost two digits of the integer in the stocks table to work with them.)
Also, since there are 24 hours in the day, will I need 24 seperate queries for each interval or is there an easier way to iterate through. I don't believe I can use wildcards with integer types so I'm lost on this.
Thanks for all your help and let me know if I have to clear anything up. I'm writing this in kind of a rush.
