For mysql thread-related questions, could you tell me the top score-php Tutorial

Source: Internet
Author: User
For mysql thread problems, please consult the heroes. the top ranking has points! Select & nbsp; number & nbsp; from & nbsp; numbertable & nbsp; where & nbsp; number & nbsp; (& nbsp; SELECT & nbsp; sum (todayhit) & nbs mysql thread question, ask the grand knight, top score!
Select number from numbertable where number =
(
SELECT sum (todayhit) as todayhit FROM hittabel
)

I want to make a click statistics. when sum (todayhit) is equal to the number in the numbertable table (set in advance), the netizen will be given a prize,

The problem with this statement is that when many people click yes at the same time, the number will be left blank so that the number I set will be missed. this problem only occurs when a large number of people click at the same time, I personally think it is a MYSQL thread problem. do you have a good idea? I don't want to miss the winning number in my operations. you don't need a database.

------ Solution --------------------
Do you understand
------ Solution --------------------
Will the number be left empty?
------ Solution --------------------
Jf ~~
The next Manual is quite detailed.
This is generally the case (for reference, refer to the manual + google)
To the database where the table is located
Mysql> delimiter //
Mysql> create procedure test (out p int)
Mysql> begin
Mysql> SELECT @ a: = sum (todayhit) FROM hittabel;
Mysql> select number into p from numbertable where [email protected]
Mysql> end ;//
Mysql> delimiter;
Time:
Mysql> call test (@ num );
Mysql> select @ num;
------ Solution --------------------
A solution is to lock the table.

It seems that there are too few people reading the manual. There are many MySQL databases, including the self-locking table and the locking database, which are just a few. please read the manual a little.

I have used a few things in this regard. I forgot the specific content. Sorry ~
------ Solution --------------------
MYSQL stored procedure is not recommended
Immature...
------ Solution --------------------
Rollback
------ Solution --------------------
Top

------ Solution --------------------
Transactions
------ Solution --------------------
I basically don't need stored procedures
------ Solution --------------------
Think about this problem from another angle...
Or system architecture design issues.

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.