If auditQueryName contains the query name and not the query:
<cfset myQuery = Evaluate(auditQueryName)>
<CFQUERY name="GetLastRecord" datasource="#application.datasrc#">
        SELECT MAX(#ListGetAt(myQuery.Columnlist, 1)#) AS key
        FROM #auditQueryTable#
</CFQUERY>

-----Original Message-----
From: Martin Sutton [mailto:[EMAIL PROTECTED]]
Sent: maandag 4 februari 2002 13:59
To: CF-Talk
Subject: SELECT MAX Problem.


Dear all,

I am having trouble with the following query:

<CFQUERY name="GetLastRecord" datasource="#application.datasrc#">
        SELECT MAX(#ListGetAt(#auditQueryName#.Columnlist, 1)#) AS key
        FROM #auditQueryTable#
</CFQUERY>

CF gives me an error:

Invalid expression format.

If I surround it in "" it tries the query:

SELECT MAX(UpdateUsers.Columnlist) AS key FROM systemusers

This obviously gives me a SQL syntax error. It also is not correct since 
it
seemingly ignores ListGetAt().  I think it is to do with variable 
resolution
ultimately but I am not sure.

I want to get the last inserted ID from a different query.  Am I going 
about
it the wrong way?

Regards,

Martin.

______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to