I have two tables :
table1 :
acc_id acc_desc
Code
100 cost1Code
1002 cost2Code
1003 cost3Code
1004 cost4table2:
t_id t_date t_value t_fId t_tId
Code
1 1/1/2014 90$ 100 1001Code
3 2/1/2014 50$ 100 1003Code
4 3/1/2014 50$ 1002 100Code
5 7/1/2014 50$ 100 1003
6 8/1/2014 50$ 1002 100Code
7 9/1/2014 150$ 100 1003
8 10/1/2014 200$ 1004 100Code
8 10/1/2014 200$ 100 1004now ,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)
Code
no. date sum1 sum2Code
1 ....... 140& 50$ this is row before the date 7/1/2014Code
2 7/1/2014 50& 0Code
3 9/1/2014 150$ 0Code
4 10/1/1014 200$ 0Code
3 8/1/2014 0 200$Code
Code

kapil suri3 reputationPosted Feb 14, 2014, 12:43 PM EST