Page 1 of 1

using fieldnames in LIMIT clause

Posted: Tue Feb 10, 2009 10:46 am
by kendall
Can you use a fieldname whose data type is INT in a LIMIT clause?

I am conducting the following subquery statement
[sql]SELECT FirstName, LastName, EmailAddress, (SELECT s.code FROM      northstar_access_codes AS s      WHERE s.type = 'readwrite'      ORDER BY RAND() LIMIT 0,COUNT(`readwriteclasses`)) AS RWCode, (      SELECT s.code      FROM northstar_access_codes AS s      WHERE s.type = 'learnspeak'      ORDER BY RAND() LIMIT 0,COUNT(`learnspeakclasses`)) AS LSCode, (      SELECT t.code      FROM northstar_access_codes AS t      WHERE t.type = 2      ORDER BY RAND() LIMIT 1) AS TeacherCode      FROM crm_contacts1, northstar_information      WHERE AccountID = contactid AND AccountID IN('%s')      AND northstar_informaton.`Status` = 1[/sql]
where `learnspeakclasses` is an INT field in northstar_information. Can I use fieldnames and values in this manner?

Re: using fieldnames in LIMIT clause

Posted: Tue Feb 10, 2009 12:31 pm
by Weirdan
No, you can only use constants in limit clause