Update multiple data entries

Source: Internet
Author: User
Update multiple data entries update 'article' set ppercent = '". $ weihbl. "'Where userid in ('". $ sid. "') AND aid in ('". $ aid. "') and sta in ('0 ')").

Dear friends, I want to set ppercent in the articles table that meets the preceding three conditions to the same value. Therefore, it is to update multiple data records. it seems that this sentence is incorrect, what should I do? Thank you !!


Reply to discussion (solution)

You should print the variables to see if the syntax is correct. You 'd better check the generated SQL statement and run it in the MySQL tool to see what error is reported.

What's the problem?
SQL command syntax error
Or is the actual result different from what you expected?

There should be three data entries that meet the condition, but one is updated. Thank you.

1. print the SQL command
2. provide relevant data

There should be three data entries that meet the condition, but one is updated. Thank you.



It is possible that there are three matching data records, but the ppercent value of the two data records has not changed, so there is only one influence.

How can I print SQL commands? I know this is a weak problem.

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.