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? 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. 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! 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
Archived
This topic is now archived and is closed to further replies.