join in t-sql


i have statement 

select accountname account logindate > @startdate , logindate<= @enddate , accountname not in (select accountname account  logindate > dateadd(dd,-1, @startdate) , logindate<= dateadd(dd,-1,@enddate))

but database big , want optimize them , want left join replace don't know write statement left join above condition,

can me ?

and have idea optimize them , please me

thanks all

 select r.accountname (select accountname account logindate > @startdate , logindate<= @enddate , accountname )r left join  (select accountname account  logindate > dateadd(dd,-1, @startdate) , logindate<= dateadd(dd,-1,@enddate))l on r.accountname=l.accountname l.accountname null

vt

please mark answered if i've answered question , vote helpful other user's find solution quicker



SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........