Author:
Riateche
Description:
Language: SQL
SELECT * FROM (
SELECT id, 1 as post_type, last_comment_time FROM posts WHERE owner= 3494430
UNION
SELECT id, 2 as post_type, last_comment_time FROM photos WHERE owner= 3494430
UNION
SELECT id, 3 as post_type, last_comment_time FROM photoposts WHERE owner= 3494430
UNION
SELECT id, 4 as post_type, last_comment_time FROM discussions WHERE owner= 3494430
UNION
SELECT id, 1 as post_type, last_comment_time FROM posts WHERE id IN (
SELECT post FROM subscriptions WHERE user = 3494430 AND post_type=1 )
UNION
SELECT id, 2 as post_type, last_comment_time FROM photos WHERE id IN (
SELECT post FROM subscriptions WHERE user = 3494430 AND post_type=2 )
UNION
SELECT id, 3 as post_type, last_comment_time FROM photoposts WHERE id IN (
SELECT post FROM subscriptions WHERE user = 3494430 AND post_type=3 )
UNION SELECT id, 4 as post_type, last_comment_time FROM discussions WHERE id IN (
SELECT post FROM subscriptions WHERE user = 3494430 AND post_type=4 )
) posts
WHERE last_comment_time > 0 ORDER BY last_comment_time DESC LIMIT 0, 4
|
Recent pastes:
123123123 (PHP)
ksurent (Perl)
ksurent (Bash)
guata (Plain Text)
biophreak (Plain Text)
Raik (PHP)
MUSbKA (Plain Text)
MUSbKA (Plain Text)
nekitozzz (C++)
nekitozzz (Plain Text)
nekitozzz (C++)
ksurent (Perl)
MUSbKA (C++)
stalin_alex (C++)
dzantiev (Plain Text)
unreal (C++)
eug2b (Plain Text)
|