mnuaimi nuaimi

mnuaimi nuaimi

  • 1.4k
  • 271
  • 1.4k

Writing a select query ? oracle 10g and c#.net 2010

Feb 14 2014 5:13 PM

I have two tables :

table1 : 
acc_id        acc_desc
100             cost1 
1002            cost2
1003            cost3
1004            cost4
 
table2:
t_id       t_date       t_value           t_fId        t_tId    
 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$



Answers (1)