Multiple duplicate names in the database to go heavy

Source: Internet
Author: User

2015-12-14

When you make a TextBox drop-down box, you need to display the kind of messages stored in the database. But because the same message is constantly in the insert, so caused by the name of a bad fetch message.

For example a scheme has B and c two messages, and both messages are always inserted, but the insertion time is not the same, then there are two ways:

One: Only the names of the B and C messages are taken out. You can use the select DISTINCT name from table

Two: Not only to take out the name but also to calculate and the like can be used with select Name,sum (ID) from table group by name;

Select name, ID from table group by name;--This sentence takes out the last record ID for each message

Multiple duplicate names in the database to go heavy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.