Currently i require that if time is before noon for current day, then it should take the item_2 value of prev day for current day only. for others it will take, their proper values.
id | item_1 | item_2 | date
1 205 3 2015-04-07
2 215 35 2015-04-06
3 225 15 2015-04-05
4 235 315 2015-04-04
Expected result wen time is before noon
id | item_1 | item_2 | sum | date
1 205 35 240 2015-04-07
2 215 35 250 2015-04-06
3 225 15 240 2015-04-05
4 235 31 266 2015-04-04
Expected result wen time is after noon
id | item_1 | item_2 | sum | date
1 205 3 208 2015-04-07
2 215 35 250 2015-04-06
3 225 15 240 2015-04-05
4 235 31 266 2015-04-04
Date and time can be used from php and how to manage for prev and current day record in same query. i tried with sub query, but i think it can be done in other way also.
Thanks in advance.