Ask a Question related to Coldfusion Database Access, Design and Development.
-
Explorer5 #1
Querying a date closest to today
How can i write a query that looks for the date that is closest to today, and
only returns one record? I dont want to do a date range because the date may be
in the past or future, and it may be the previous day, or 20 days out...
Thanks, Andrew Calvo
Explorer5 Guest
-
Finding a date closest to a specific date
I have a table which has a bunch of dates, from 2003, all the way until 2006. I'm trying to figure out an SQL statement which will allow me to find... -
SUPER-UX Cray - what is the closest popular unix version ?
Hi, Which unix version is the closest to SUPER-UX ? Is HP-UX a good guess ? Unfortunately I can't afford to buy a Cray but would like to... -
Converting RGB colors to closest Pantone
This sound like it should be obvious but I can't see how to do this. I'm working on graphics created for websites and the colors are all RGB. I... -
compare a date in db field to today
Hi I have a date field in Access that I want to return if the date is less than 30 days old. i have built this query, but I'm not using the... -
[DVD burner] Which one to buy today?
I am thinking about buying an external firewire DVD burner for my G4 iMac 700mhz, 512MB ram. Which one would be today the best one, e.g. the most... -
mcsenow #2
Re: Querying a date closest to today
If you use MS SQL version 7 or later, you can try
SELECT TOP(1) FROM table WHERE datecolume < getdate()
mcsenow Guest
-
OldCFer #3
Re: Querying a date closest to today
You can use:
SELECT TOP 1 MIN(ABS(DATEDIFF(mi, SOMEDATE, GETDATE())))
then Order by
MIN(ABS(DATEDIFF(mi, SOMEDATE, GETDATE())))
OldCFer Guest



Reply With Quote

