The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
How delete post older than x?
Discuss How delete post older than x? in the MySQL Help forum on Dev Shed. How delete post older than x? MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 19th, 2012, 04:16 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
Time spent in forums: 47 m 24 sec
Reputation Power: 0
|
|
|
How delete post older than x?
Hi guys,
How delete post older than x and shorter than y? It is in Wordpres MySQL database. I´ve tried:
SELECT *
FROM `wp_posts`
WHERE `post_type` = 'post'
AND DATEDIFF( NOW( ) , `post_date` ) >350
AND LENGTH( `post_content` ) <50
so SELECT is for selecting, I use than DELETE...
but it is not working. Whats is wrong? Thanks a lot. Peter
PS: I am newbie...sorry 
|

December 19th, 2012, 04:33 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
Hi,
how could we tell you why it's "not working" (whatever that means) when we don't even have your query?
Post your actual DELETE query. What happens when you execute it? Do you get a syntax error? Does it simply not delete the rows it should delete?
|

December 19th, 2012, 04:41 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
Time spent in forums: 47 m 24 sec
Reputation Power: 0
|
|
|
ok - so it is so
I have large database with posts of Wordpress. I mean over 500 000 rows. And I would like to DELETE rows, in where are posts shorter than 50 characters and older than 60 days. (both contitions have to be realize together).
The CODE is only my experiment, how it do....Thanks Peter
|

December 19th, 2012, 05:05 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
Quote: | Originally Posted by sikec The CODE is only my experiment, how it do.... |
So? Just post the DELETE query, then we can fix the errors.
I'm not sure what you expect from us. I mean, when you already have a query, what's the problem with using it? What you've written down above looks pretty good. But you should use CHAR_LENGTH() instead of LENGTH() to account for multibyte encodings.
|

December 19th, 2012, 05:10 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
Time spent in forums: 47 m 24 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by Jacques1 So? Just post the DELETE query, then we can fix the errors.
I'm not sure what you expect from us. I mean, when you already have a query, what's the problem with using it? What you've written down above looks pretty good. But you should use CHAR_LENGTH() instead of LENGTH() to account for multibyte encodings. |
I expect the CODE which is functional. My CODE is wrong - it is finding only two rows...but in database are thaousands of these posts, than are short than 50 and older than 60 days....
|

December 19th, 2012, 05:17 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|
You do realize that the above query requires the posts to be older than 350 days?
But since you obviously don't want to work on your own query and instead expect us to write you a new one, you'll have to wait for our query service. I won't do that.
|

December 19th, 2012, 05:22 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
Time spent in forums: 47 m 24 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by Jacques1 You do realize that the above query requires the posts to be older than 350 days?
But since you obviously don't want to work on your own query and instead expect us to write you a new one, you'll have to wait for our query service. I won't do that. |
60 was second experiment...ok, thank you, but reason is not on the world, it is perhaps too hard...I see...
|

December 19th, 2012, 05:31 AM
|
 |
pollyanna
|
|
Join Date: Jul 2012
Location: Germany
|
|
|
Well, it seems it's too hard for you to copy and paste a fricking query into this forum.
I asked you again and again to show your query, but you keep wasting our time with "experiments" that "don't work". What's the point of that? Give us your actual, real query. Then we can tell you what's wrong. Enough with the "experiments".
Anyway, I'm not interested in this kind of game. Bye.
|

December 19th, 2012, 05:54 AM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 6
Time spent in forums: 47 m 24 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by Jacques1 Well, it seems it's too hard for you to copy and paste a fricking query into this forum.
I asked you again and again to show your query, but you keep wasting our time with "experiments" that "don't work". What's the point of that? Give us your actual, real query. Then we can tell you what's wrong. Enough with the "experiments".
Anyway, I'm not interested in this kind of game. Bye. |
I must apologize..it is my fault...you have true, it is only in CHARL_LENGHT...thank you Jacques1 for help! Peter
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|