davefootball123 Posted July 23, 2013 Share Posted July 23, 2013 I have a MYSQL database that stores warning information for given regions, there are about 30 or 40 regions that I cover. If a warning is issued for the region the "type" row in the MYSQL database will be filled with the type of warning in effect for that given region. Often multiple regions have the same type of warning, and what I am looking to do is just get the first instance of each warning type in the database so I can create a legend with the warnings that are in effect. Any help would be great, if you need anymore information on how the db is setup, please let me know. Thanks for your time, Dave Quote Link to comment https://forums.phpfreaks.com/topic/280441-eliminate-duplicates-from-mysql-query/ Share on other sites More sharing options...
Psycho Posted July 23, 2013 Share Posted July 23, 2013 Use DISTINCT or a GROUP BY. Since you are only wanting to get the warning types use DISTINCT. Something like: SELECT DISTINCT warning_type FROM warnings Also, why did you post this in the PHP forum and not the MySQL forum? << Moving >> Quote Link to comment https://forums.phpfreaks.com/topic/280441-eliminate-duplicates-from-mysql-query/#findComment-1441875 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.