Home > database >  The Mysql code should be how to delete data, to determine the two
The Mysql code should be how to delete data, to determine the two

Time:10-02

 DELETE FROM ` pre_forum_post ` WHERE ` dateline ` & lt; $time AND ` first `=0 AND ` authorid ` & lt;> (dar found out in judgment is not equal to which it is first=1 that the building Lord authorid) within the LIMIT of 999999 

DELETE FROM ` pre_forum_post ` WHERE ` dateline ` & lt; $time AND ` first `=0 AND ` authorid ` & lt;> (dar found out in judgment is not equal to which it is first=1 that the building Lord authorid) within the LIMIT of 999999

ask next the mysql within the same table to estimate how to write two data at the same time, the number of pid is post (only), it has a dar field represents belongs to which subject placard, authorid is contributions, not the building field must according to the first=1 and find out that to get the 1st floor of the building Lord authorid judgment is not equal to,
Remove time $time before reply except the building Lord, how to write?


Is new PHP mysqli () link database.

CodePudding user response:

The DELETE FROM ` pre_forum_post ` WHERE a. a. ` dateline ` & lt; $time AND a. ` first ` & lt;> 1 the AND a. ` authorid ` & lt;> (SELECT b. ` authorid ` FROM ` pre_forum_post ` b WHERE b. ` dar `=a. ` dar ` AND b. ` first `=1) LIMIT of 999999
I like to write directly to syntax errors

CodePudding user response:

 
DELETE a
The FROM pre_forum_post a
WHERE a. d. ateline<$time AND a.f irst<> 0
AND not the exists (SELECT 1 FROM pre_forum_post b WHERE b.t id=a.t id AND a.a uthorid=b.a uthorid AND b. irst=1)
  • Related