Using a column as a limit... possible?
Posted: Tue Mar 03, 2009 7:19 am
Very quick question which doesn't appear to work, but thought I would throw it open to people more clever that me.
I have tried the following, both of which end up with a syntax error. Seems MySQL is expecting a number and nothing else.
I have tried the following, both of which end up with a syntax error. Seems MySQL is expecting a number and nothing else.
Code: Select all
SELECT field_1, field_2
FROM my_table
LIMIT field_3Code: Select all
SELECT field_1, field_2, (@limit:=(field_3))
FROM my_table
LIMIT @limit