how to rewrite query of temp table to subquery or join in sql
<p>I need help Please.I have a query that was inserted into two different temp table. How can i rewrite the query again to avoid the use of temp table.
For example, </p>

<pre><code>declare @sdate as datetime
declare @edate as datetime

set @sdate = '01-Apr-2016 00:00:00'
set @edate = '31-Mar-2017 23:59:59'

/*Falls*/
Select
    DISTINCT
    R.ID
    ,C.EmpNo
Into #FALLS
from
    tableA as R
    left join  tableB as C
    on R.ID = C.ID
where
    R.[dateTime] between @sdate and @edate 
/*Phys  */
Select
    DISTINCT
    A.ID
    ,(A.ActualTime) as [DateTime]
    ,A.SeqID 
into #Physio
from
    tableC as A
    left join #FALLS as Falls
    on Falls.ID = A.ID 

/* COMBINE RESULT */
Select
    P1.ID
    ,P1.EmpNo
    ,P1.SeqID   
from
    (Select
        DISTINCT
        Falls.ID
        ,Falls.EmpNo
        ,MIN(Physio.[DateTime])         
    from
        #FALLS as Falls
        left join #Physio as Physio
        on Falls.ID = Physio.ID 

    group by
        Falls.ID
        ,Falls.EmpNo
    ) as P1
    left join #Physio as P2
    on P1.ID = P2.ID 
</code></pre>

<p>How can i rewrite the sql without using temp tables.</p>