phpjayx Posted December 28, 2012 Share Posted December 28, 2012 I've used the following $sql_select = "select DISTINCT NUMBER1 from Data where check1='1' and userid='" . $param['userid'] . "' order by timestamp asc"; ----- It correctly gets the data for just the distince values from NUMBER1, but I would like to grab more data that is not necessarily distinct... like the TIMESTAMP, or even the persons name depending on how my user has entered it, they may have entered it with a first and last name or just a first name, so I only want to grab one instance of it..... Thanks in advance Quote Link to comment Share on other sites More sharing options...
Barand Posted December 28, 2012 Share Posted December 28, 2012 You could use GROUP BY SELECT number1, timestamp, firstname, lastname FROM Data WHERE check1='1' AND userid='{$param['userid']}' GROUP BY number1 ORDER BY timestamp However, if several people have the same number1, you will only see one of them Quote Link to comment Share on other sites More sharing options...
phpjayx Posted December 28, 2012 Author Share Posted December 28, 2012 Perfect, that works. Many thanks! Quote Link to comment 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.