This content has been marked as final. Show 9 replies
It looks like you are attempting to use a CF function against a database column within the WHERE clause of a query, which really won't work. You should use the applicable database function for your particular database to extract the year from the date column. For Oracle, it would be TO_CHAR(datePosted, 'YYYY') and in SQL Server it would be something like datepart('yyyy', datePosted), etc. No #'s either.....
You are using ColdFusion functions where you need to be using SQL
functions. What the exact function is will depend on which DBMS you
use, but they are easy to find in the documentation and|or Google.
Thanks Phil, that worked fine.
Until I noticed that the user added all the documents this year and actually
wants them sorted by the first 4 letters of the title (which happen to be a
date). I need to actually preform what equates to a #left(datePosted,4)#.
Any ideas on how to do that?
Wally Kolcz wrote:
> I need to actually preform what equates to a #left(datePosted,4)#.
> Any ideas on how to do that?
All the Database Management Systems that I have worked with have an
equivalent function, they very by DBMS, but it should not be hard to
find in the documentation and|or on line.
I have been searching google and I keep coming up with trimming the white
space off a result. lol. Back to the google.
I am using MSSQL
Something like this?
ORDER BY LEFT(title, 4)
ORDER BY SUBSTR(title, 1, 4) etc...
Thank you very much, that worked.
"paross1" <email@example.com> wrote in message
> Something like this?
> ORDER BY LEFT(title, 4)
> --or this--
> ORDER BY SUBSTR(title, 1, 4) etc...