I have a table that holds I and R dates under the Act column, so far so good I am able to get the duration\_total but i am unable to get duration\_before\_issuing and processing\_duration because all that data which determines that sits on one same table tracking, so i have a challange finding `where t.Act = I and t.Act = R` at the same time to give the result as shown in the last diagram. Any suggestions?

---

My SQL-Transact

```
SELECT  t.product, r.pro_name, r.d_date, t.Date,  DATEDIFF(t.Date, r.d_date) as duration_total
FROM tracking t, request r 
WHERE t.product = r.product
AND t.Act ='R'

```

tracking t

```
product | Act | Date
---------------------------
a       | I |    date-i
--------------------------
a       | R |    date-r
---------------------------
b       | I |    date-i
---------------------------
b       | R |    date-r

```

request r

```
product  | pro_name | d_date
------------------------------------------
a        | wacha    | date-d
------------------------------------------
b        | wewe     | date-d

```

Result

```
pro| pro_name      | duration_before_issuing    |  processing_duration |     duration_total
---------------------------------------------------------------------------------------------------
a  |  wacha  | t.Date(date-i)- r.d_date(date-d) | t.Date(R) - t.Date(I) | t.Date(R)- r.Date(r.d_date)
---------------------------------------------------------------------------------------------------
b  |  wewe   | t.Date(date-i)- r.d_date(date-d) | t.Date(R) - t.Date(I) | t.Date(R)- r.Date(r.d_date)

```