I want to select "currentrow" as part of my query - I know I can loop over queries and get the "currentRow" variable, but I'm doing a QoQ before I use the rows and I want to keep the original rows, e.g.
This is the code I've got:
q = new Query( datasource = application.db.comcar );
q.setSQL(' SELECT make, @rownum := @rownum +1 AS `rownumber` FROM cars, ( SELECT @rownum :=0 ) LIMIT 10 ');
r = q.execute().getResult();
But it's throwing the following error:
Parameter '=' not found in the list of parameters specified
SQL: SELECT make, @rownum := @rownum + 1 AS `rownumber` FROM cars, ( SELECT @rownum :=0 ) LIMIT 10
This will work in "cfquery" but I'd like to use it in CFScript. Is there an alternative to using ":=" or some way of escaping this in the query.