mds1256 Posted August 5, 2012 Share Posted August 5, 2012 Hi is there a way to use the LIMIT keyword but return all rows. I am wanting to build a dynamic stored procedure that allows you to pass in a parameter to limit rows if you want to. e.g. select * from users limit ** ----- where ** could be a number or all I can get it to work with a number but If I want all rows what would I put in place of the **'s Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/ Share on other sites More sharing options...
Barand Posted August 5, 2012 Share Posted August 5, 2012 4000000000 Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1366960 Share on other sites More sharing options...
fenway Posted August 5, 2012 Share Posted August 5, 2012 2^32 - 1 works too -- but I don't think you can use expressions in the LIMIT. Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1366963 Share on other sites More sharing options...
mds1256 Posted August 5, 2012 Author Share Posted August 5, 2012 4000000000 why that number? Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1366973 Share on other sites More sharing options...
fenway Posted August 5, 2012 Share Posted August 5, 2012 Barand just knows everything -- including the power of secret and magic constants. Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1366998 Share on other sites More sharing options...
Barand Posted August 5, 2012 Share Posted August 5, 2012 4000000000 why that number? It's approximately the max value of an unsigned integer (4,294,967,295) ie 2^32 as Fenway indicated. But any number higher than the max number of records in your table would suffice. Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1367002 Share on other sites More sharing options...
mds1256 Posted August 5, 2012 Author Share Posted August 5, 2012 Thank you to both of you Quote Link to comment https://forums.phpfreaks.com/topic/266706-mysql-limit/#findComment-1367009 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.