Copy link to clipboard
Copied
This is probably simple but I can't find a solution...
Maybe brain not in right place...
I have multiple dates... ie data entry on different dates...
And want to search these entries... And display only the year...
ie... Data entered in 2011 and 2012...
Want to display output of "2011" and "2012" to break down the dates...
cfquery name="staty" datasource="fpb">
select * from inspid
where inspectorid = #session.inspuser_id#
order by inspdate desc
cfquery>
Output - just the years - from multiple dates...
Seems simple - but I can't get it in my head...
Thx
Thanx for the sarcasim...
Yes I consider google my textbook...
Answer here...
<cfquery name="staty" datasource="fpb">
select distinct year(inspdate) AS yydate from inspid
where inspectorid = #session.inspuser_id#
</cfquery>
<cfoutput query=staty>
#yydate#
</cfoutput>
Coding was blurred in my head...
Copy link to clipboard
Copied
The way to select just the year portion of a date field depends on the type of db you are using.
Copy link to clipboard
Copied
Using MS Access
Copy link to clipboard
Copied
Seriously, what's with all the people using Access lately? They giving away licences with Happy Meals or something?
"I can't find a solution" - How hard have you tried? Try Googling "Access date functions" - ah, there's a year() function. I wonder what that does...
Oh, and don't do "select *".
Copy link to clipboard
Copied
"I can't find a solution" - How hard have you tried? Try Googling [...]
Wow. Didn't know you could do that.
--
Adam
Copy link to clipboard
Copied
Thanx for the sarcasim...
Yes I consider google my textbook...
Answer here...
<cfquery name="staty" datasource="fpb">
select distinct year(inspdate) AS yydate from inspid
where inspectorid = #session.inspuser_id#
</cfquery>
<cfoutput query=staty>
#yydate#
</cfoutput>
Coding was blurred in my head...