Guest User

Untitled

a guest
Aug 10th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Set row as another row - MySQL
  2. mysql_query("
  3. UPDATE users SET
  4.  
  5. `clicks_yesterday`=`clicks_today`,`clicks_today`=0)
  6.  
  7. UPDATE users SET clicks_yesterday = clicks_today;
  8. UPDATE users SET clicks_today = 0;
  9.  
  10. CREATE TABLE `duals` (
  11. `one` int(11) DEFAULT NULL,
  12. `two` int(11) DEFAULT NULL
  13. );
  14.  
  15. insert into duals values (1, 2);
  16.  
  17. select * from duals;
  18. +------+------+
  19. | one | two |
  20. +------+------+
  21. | 1 | 2 |
  22. +------+------+
  23.  
  24. update duals set one = two, two = 0;
  25.  
  26. select * from duals;
  27. +------+------+
  28. | one | two |
  29. +------+------+
  30. | 2 | 0 |
  31. +------+------+
Add Comment
Please, Sign In to add comment