View Single Post
Old 10-23-2009, 07:49 PM   #2 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Temporary tables are Snazzy. I bypassed having to code any extra PHP to do this by using straight SQL;

Code:
CREATE TEMPORARY TABLE old_data SELECT * FROM `wp_1_statpress` WHERE SUBSTR(timestamp, 1, 10) = '2009-10-22' LIMIT 30
DELETE FROM `wp_1_statpress` WHERE SUBSTR(timestamp, 1, 10) <> '2009-10-23'
INSERT INTO `wp_1_statpress` SELECT * FROM `old_data`
This seems to be a pretty speedy way of getting what I wanted done, but nevertheless if I could perform it one query, I would prefer to do so. So while the problem is resolved for all intensive purposes, if anybody can see what's wrong with my original query I'd still be interested.
delayedinsanity is offline  
Reply With Quote