Page 1 of 1

LIMIT by row field

Posted: Thu Feb 19, 2009 9:44 am
by someberry
I have a table which says how many rows to pull out the database. However, instead of having to do a query to get the row limit and then perform the actual query, I would like to combine the query. However, I don't think MySQL allows for this. Example of what I would like to do is below:

Code: Select all

SELECT a.field,
FROM `a_table` a, `b_table` b
WHERE b.table_id = a.table_id
LIMIT b.limit

Re: LIMIT by row field

Posted: Thu Feb 19, 2009 11:22 am
by John Cartwright
Unfortunately, mysql only allows for constants in the LIMIT clause.