Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.54 KB | None | 0 0
  1. INSERT INTO `player_history` (`player_id`, `date`, `races`, `maps`, `playtime`, `points`)
  2. SELECT `p`.`id`, DATE_SUB(NOW(), INTERVAL 1 DAY), `p`.`races`, `p`.`maps`, `p`.`playtime`, `p`.`points`
  3. FROM `player` `p`
  4. WHERE `p`.`playtime` IS NOT NULL
  5. AND `p`.`playtime` > 0
  6. AND (SELECT `player_id`
  7.   FROM `player_history`
  8.   WHERE (`player_id` = `p`.`id`
  9.     AND `date` < NOW())
  10.     OR( `playtime` = `p`.`playtime`
  11.     AND `races` = `p`.`races`
  12.     AND `points` = `p`.`points`
  13.     AND `maps` = `p`.`maps`)
  14.     ORDER BY `date` DESC
  15.     LIMIT 1) IS NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement