Query of a Query Extract Time from DateTime Field
Thanks in advance for your help!
How do I extract time from a datetime field in a Query of a Query and sort the results by the time? "aDateTime" is a datetime field in an MS-SQL database. We are using ColdFuson 5.
<cfquery name="anSQLquery" datasource="#aDataSource#" dbtype="odbc">
Select *
from aTable
</cfquery>
ATTEMPT 1:
<cfquery dbtype="query" name="aQueryOfQuery">
select *,
cast(aDateTime as time) as aTime
from anSQLquery
order by
aTime
</cfquery>
<cfdump var="#aQueryOfQuery#">
RESULT:
aTime
{ts '2012-02-27 08:00:00'}
Which is not what is wanted, which is something like:
{ts '1900-01-01 08:00:00'} or
{ts '08:00:00'} or
'08:00:00' or
'08:00'
Other attempts:
datepart(BEGIN_DATE_TIME, "HH:mm") as MeetTime
right(cast(BEGIN_DATE_TIME as varchar),8) as MeetTime
Result in errors.
Thanks,
Jeff
