1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| (
SELECT p.id AS pid, p.message, p.poster, p.posted, t.id, t.subject, t.num_replies, t.last_post, f.id AS fid, f.forum_name, f.quickpost, c.cat_name
FROM posts AS p
INNER JOIN topics AS t ON p.id = t.last_post_id
INNER JOIN forums AS f ON f.id = t.forum_id
INNER JOIN categories AS c ON f.cat_id = c.id
LEFT JOIN forum_perms AS fp ON ( fp.forum_id = f.id
AND fp.group_id =3 )
WHERE (
fp.read_forum IS NULL
OR fp.read_forum =1
)
AND t.moved_to IS NULL
)
UNION
(
SELECT id AS pid, description AS message, 'p' AS poster, date_validation AS posted, id, titre AS subject, 'n' AS num_replies,date_validation AS last_post, 999 AS fid, 'f' AS forum_name, 'q' AS quickpost, 'c' AS cat_name
FROM annu_sites
WHERE activation =1
)
ORDER BY last_post DESC
LIMIT 20 |
Partager