1 1/1/2014 90$ 100 1001
3 2/1/2014 50$ 100 1003
4 3/1/2014 50$ 1002 100
5 7/1/2014 50$ 100 1003
6 8/1/2014 50$ 1002 100
7 9/1/2014 150$ 100 1003
8 10/1/2014 200$ 1004 100
8 10/1/2014 200$ 100 1004
now ,
How can I write a query so that the result of the table are as follows:t_date is between dates (7/1/2014,11/1/2014) and (t_fId =100 or t_tId=100) no. date sum1 sum2
1 ....... 140& 50$ this is row before the date 7/1/2014
2
7/1/2014 50& 0
3 9/1/2014 150$ 0
4 10/1/1014 200$ 0
3 8/1/2014 0 200$