Interogari ale bazei de date WordPress

WordPress 3.2

Lista posturilor în ordine invers cronologică (dupa ID-uri):
(Published posts order by id)

SELECT id, post_title, post_name, comment_count
FROM `wp_posts`
WHERE post_status=’publish’ AND post_type=’post’
ORDER BY id DESC

Aceeași listă dar cu URL-ul posturilor (necesita Counterize)
SELECT t1.id, t1.post_title, t1.post_name, t1.comment_count, t2.url
FROM `wp_posts` t1
INNER JOIN
(SELECT t3.postID, url
FROM wp_Counterize_Pages t3
INNER JOIN
(SELECT postID, MIN(LENGTH(url)) length FROM wp_Counterize_Pages group by postid) t4
ON t3.postID=t4.postID AND LENGTH(t3.url)=t4.length) t2
ON t1.id = t2.postID
WHERE post_status=’publish’ AND post_type=’post’
ORDER BY id DESC


Articole recomandate:

Samsung 40D5003 Review
TV Samsung 40D5003 Review
Un TV convenabil!
221 comentarii
Samsung 32D5800 Review
Fratele mai mare a lui 32D5000
16 comentarii
ID post = 688
FoxPro - Read Url
Nu ca ar fi prea multi amatori...
ID post = 685
Fox Pro String Functions
Cateva notite.





Leave a Reply

Your email address will not be published. Required fields are marked *