Try moving your 3rd # sign like this... <CFQUERY name="GetLastRecord" datasource="#application.datasrc#"> SELECT MAX(#ListGetAt(#auditQueryName.Columnlist#, 1)#) AS key FROM #auditQueryTable# </CFQUERY>
----- Original Message ----- From: "Martin Sutton" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Monday, February 04, 2002 4:59 AM 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. > ______________________________________________________________________ Why Share? Dedicated Win 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=coldfusionc 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

