Home > database >  Please the teacher give a SQL statement
Please the teacher give a SQL statement

Time:10-11

Select * from zf_post_cz where type=0 and to_days (create_time)=to_days (now ());
It is concluded that

CodePudding user response:

To build a temporary table, field ids, player_name, now, create_time, prev_d, prev_create_time

With group by the last record in the each player's id, player_name, now, create_time inserted into a temporary table, associated player_name again, now the former a record id and create_time updates to the temporary table prev_d, prev_create_time, the last query in the temporary table two create_time interval in 1 hour

CodePudding user response:

reference 1/f, the heavy rain will respond to:
create a temporary table, field ids, player_name, now, create_time, prev_d, prev_create_time

With group by the last record in the each player's id, player_name, now, create_time insert temporary tables, correlation player_name again, now the former a record id and create_time updates to the temporary table prev_d, prev_create_time, finally the query in the temporary table two create_time interval in 1 hour


Teacher, temporary table set up, because PHP is self-study before long, you said

With group by the last record in the each player's id, player_name, now, create_time inserted into a temporary table, associated player_name again, now the former a record id and create_time updates to the temporary table prev_d, prev_create_time

A bit not understand, can say detailed under it

CodePudding user response:

Write a stored procedure, traversal in it

CodePudding user response:

The
reference cloud fly me reply: 3/f
write a stored procedure, inside traversal

Ok, thank you teacher, I see the stored procedure related knowledge
  • Related