Deltaflyer
Programmer
I am trying to run a query using BETWEEN, unfortunately the query i am running is timeing out ( it is a big query on a small dev machine ). I know that the query will run on the live machine but i think i may have found an even faster way of executing the query.
The simplified version of my coding is :
Select * From Table Where Date Is Between 'startdate' and 'enddate'
where startdate and enddate are valid date fields. Through query analyzer this is taking about 2mins to complete, however, if i try :
Select * From Table Where Date >= 'startdate' it returns in 2-3secs, equally
Select * From Table Where Date <= 'enddate' this returns in 2-3secs.
I know that i can subquery using IN but cannot get it to work.
My combination query is :
Select * Where Date >= 'startdate'
IN (Select * From Table Where Date <= 'enddate')
Is this the correct way of doing this, or could anybody please show me the correct way of doing this.
Thanks, Deltaflyer
DeltaFlyer - The Only Programmer To Crash With Style.
The simplified version of my coding is :
Select * From Table Where Date Is Between 'startdate' and 'enddate'
where startdate and enddate are valid date fields. Through query analyzer this is taking about 2mins to complete, however, if i try :
Select * From Table Where Date >= 'startdate' it returns in 2-3secs, equally
Select * From Table Where Date <= 'enddate' this returns in 2-3secs.
I know that i can subquery using IN but cannot get it to work.
My combination query is :
Select * Where Date >= 'startdate'
IN (Select * From Table Where Date <= 'enddate')
Is this the correct way of doing this, or could anybody please show me the correct way of doing this.
Thanks, Deltaflyer
DeltaFlyer - The Only Programmer To Crash With Style.