If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > UPDATE post with limit of 15 in wordpress

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-24-09, 05:03
gandolfi gandolfi is offline
Registered User
 
Join Date: May 2009
Posts: 1
UPDATE post with limit of 15 in wordpress

hello,

i'm a french user of wordpress and i want to UPDATE draft post to publish but there is few condition.

Table : "wp_posts"
rows : "post_author", "post_date", "post_status" and "post_category"

- i want to edit 15 post/day/different autor -> UPDATE "post_status = draft" to "post_status = publish"
- I want, at maximun, in the 15 post : one post by author different per category. I want to avoid there is more of one post per day of the same autor in a category.
- I want to start the update with the oldest post.

i have try with this but i have not the limit of 15 and the ORDER BY post_date ASC.

CREATE TEMPORARY TABLE tmp_posts_ignore
SELECT post_author, post_categorie
FROM wp_posts
WHERE post_status='draft'
GROUP BY post_author, post_categorie
HAVING Count(*)>=2;

UPDATE wp_posts SET post_status='publish'
WHERE wp_post_status='draft'
AND (post_author, post_categorie) NOT IN (
SELECT post_author, post_categorie
FROM tmp_posts_ignore
);


thank you.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On