It might be better to do this as a subquery like so:
<cfquery name="LastRowID" datasource="#attributes.datasource#">
select eHistory.Date_Out as columnofinterest
from eHistory
where eHistory.Equip_ID = 2
and eHistory.eHistory_ID IN (select max(eHistory.eHistory_ID) from
eHistory where eHistory.Equip_ID = 2)
</cfquery>
That way, you're not mixing the two different types of queries, but
rather performaing them separately.
Let us know if this works or not. ;)
Warm regards,
Jordan
Gonzo Rock wrote:
> using MS-SQL Server here and.... I am trying to find the largest
> eHistory_ID record and its associated Date_Out column value for the
> set of
> records whose Equip_ID = 2
>
> <cfquery name="LastRowID" datasource="#attributes.datasource#">
> select max(eHistory.eHistory_ID) as LastRow_ID, eHistory.Date_Out as
> columnofinterest
> from eHistory
> where eHistory.Equip_ID = 2
> </cfquery>
>
> is getting this error:
>
> Column 'eHistory.Date_Out' is invalid in the select list because it is
> not
> contained in an aggregate function and there is no GROUP BY clause.
>
> I am guessing there is some sub select sort of statement I should be
> using
> but... alas not hitting on it.
>
> Thanks,
> Gonz
--
Warm regards,
Jordan Michaels
Vivio Technologies
http://www.viviotech.net/
[EMAIL PROTECTED]
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

