kura2yamato

sql inseert dan update untuk hari tertentu

Jan 29th, 2021
1,056
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. CREATE TABLE `gun_views` (
  3.   `id` bigint(20) NOT NULL,
  4.   `dates` date NOT NULL,
  5.   `hits` bigint(20) DEFAULT NULL,
  6.   `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  7. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  8.  
  9. --
  10. -- Indexes for dumped tables
  11. --
  12.  
  13. --
  14. -- Indexes for table `gun_views`
  15. --
  16. ALTER TABLE `gun_views`
  17.   ADD PRIMARY KEY (`id`),
  18.   ADD UNIQUE KEY `dates` (`dates`);
  19.  
  20. --
  21. -- AUTO_INCREMENT for dumped tables
  22. --
  23.  
  24. --
  25. -- AUTO_INCREMENT for table `gun_views`
  26. --
  27. ALTER TABLE `gun_views`
  28.   MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
  29.  
  30. -------------------------------------------------------------
  31.  
  32. insert into
  33. gun_views(dates, hits)
  34. values
  35. (date_format( now(),"%Y-%m-%d"),1)
  36. ON DUPLICATE KEY
  37. update  
  38. hits = hits + 1;
  39. ---------------------------------------------------------------
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×