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