skyer2000 Posted February 14, 2008 Share Posted February 14, 2008 I have the following code for my query to find the next lowest value SELECT id FROM table WHERE fieldorder < 'current_fieldorder' LIMIT 1 For some reason though, this always finds the lowest "fieldorder" value, and not the next lower one. What am I missing here? Quote Link to comment https://forums.phpfreaks.com/topic/91151-finding-the-next-lower-value/ Share on other sites More sharing options...
AndyB Posted February 14, 2008 Share Posted February 14, 2008 SELECT id FROM table WHERE fieldorder < 'current_fieldorder' ORDER by fieldorder DESC LIMIT 1 That'll do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/91151-finding-the-next-lower-value/#findComment-467155 Share on other sites More sharing options...
skyer2000 Posted February 14, 2008 Author Share Posted February 14, 2008 Works great, thank you! Quote Link to comment https://forums.phpfreaks.com/topic/91151-finding-the-next-lower-value/#findComment-467159 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.