Jump to content

Eliminate Duplicates from MYSQL Query


davefootball123

Recommended Posts

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

Link to comment
Share on other sites

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 >>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.