Hi Everyone,
Just a quick question to ask how you all create your date ranges?
For example I have a requirement to list all records where a datefield
is between the first and las day of THIS month.
I use the following, but just wanted some verification, I suppose,
that there wasn't a better way
Perhaps you only need to consider the year and month?
select count(*) as monthOpenTotal
from tbl_car
where
year(dateRaised) = year(getdate())
and month(dateRaised) = month(getdate())
2009/2/23 Gavin Baumanis beauecli...@gmail.com:
Hi Everyone,
Just a quick question to ask
If you look at optimisation you wil find that doing the sub selects is
faster as they only get performed once. using functions on the outer select
can be more intensive.
So I would suggest Gavin's way is ok. The only thing that might help is to
make the date range outside the select as a local
select count(*) as monthOpenTotal
from tbl_car
where dateraised between beginDate and endDate
And set beginDate and endDate to date objects either in CF itself or use SQL
to do it.
There is no need to do a select on the query in your example, just turn it
into a date object an you will be fine.
Meet on Monday 23rd Feb, 2009 at 6pm for 6:30 start.
A hands on introduction the basics of developing applications using
the Cairngorm Application development framework. We'll be walking
through a provided sample application. Please bring along your
notebook with Flex Builder or
The other thing to consider is that while his current need might be to
find the records for a specific month, if he hands the function a
start date and an end date, that same code can be used for other
intervals than just the current month - e.g. this quarter, last year,
first half of the