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.