That way if no rows are returned by the default date you can do the previous
month in code rather than making CF do it with loops and all that jaz. Just
saves the processing baby!!!
<http://intranet>
Stephen E. Schuster
PeopleSoft Administrator
2000 Ashland Drive
Ashland, KY 41101
Office Phone 606.920.7447
Cell Phone 606.831.4590
-----Original Message-----
From: Ian Skinner [mailto:[EMAIL PROTECTED]
Sent: Monday, January 05, 2004 1:21 PM
To: CF-Talk
Subject: RE: SQL: Selecting Max Date Entries
SELECT *
FROM table
WHERE DateCol = (SELECT MAX(DateCol) FROM Table)
HTH
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
-----Original Message-----
From: Bryan F. Hogan [mailto:[EMAIL PROTECTED]
Sent: Monday, January 05, 2004 10:10 AM
To: CF-Talk
Subject: RE: SQL: Selecting Max Date Entries
What I want to do is something like below.
select *
from table
where month(postdatetime)=max(month(postdatetime)) and
year(postdatetime)=max(year(postdatetime))
I want the current months entries. But if there is no entries I want it
to display the previous months entries. I only want it to display 1
months worth of entries.
-----Original Message-----
From: MILAN MUSHRAN [mailto:[EMAIL PROTECTED]
Sent: Monday, January 05, 2004 1:06 PM
To: CF-Talk
Subject: RE: SQL: Selecting Max Date Entries
If you are trying to get the highest date value in the database -
use this query:
SELECT max(DateColumnName)
FROM TableName
But, If you are trying to get the highest date value in the database for
every year -
use this query:
SELECT max(DateColumnName)
FROM TableName
GROUP BY DatePart('yyyy',DateColumnName)
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

