Questions about querying multiple data entries in mysql-php Tutorial

Source: Internet
Author: User
How to query multiple data records in mysql select multiple data records to find out duplicate data records and prompt which days should be inserted into the database? solution ------------------ if you want to clear the table if the record is repeated, you can use INSERTINTO ..... SELECT ..... the statement is complete. Create a table with the same structure as the original table. use the preceding statement to query multiple data records of the original table in mysql.
How can I check multiple data entries in the select statement and tell me which days should I insert them into the database?

------ Solution --------------------
If you want to clear the duplicate records in the table, you can use the insert into... SELECT... statement to complete the operation.
Create a table with the same structure as the original table. use the preceding statement to insert all records of the original table to the new table. To create a new table, you must create a unique composite index. in this way, when you insert a table, the same record will be automatically skipped instead of inserted.
The SQL statement of the unique compound index is similar:
SQL code
Alter table 'mytable' add unique ('username', 'age ');

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.