slj90 Posted February 5, 2014 Share Posted February 5, 2014 Hello, I have a table with 3 columns, ID, Name and Status. The data under the status column will either be 'complete' or 'in_progress'. How do I find out the ID of the first row which says 'in_progress'? Do I have to search each row or is there a way to go straight to that row?Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/285971-getting-first-row-where-x-y/ Share on other sites More sharing options...
Ch0cu3r Posted February 5, 2014 Share Posted February 5, 2014 You'd use a select query with a where clause checking for Status is set to "in_progress" and then limit the results to 1 with LIMIT 1 SELECT ID, Name, Status FROM table WHERE Status='in_progress' ORDER BY ID ASC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/285971-getting-first-row-where-x-y/#findComment-1467879 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.