Unlikely because read_faq is ‘special’ and not reprogrammable or extendable. The following may do what you’re after however:
SELECT user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
WHERE topic_id = /* put the topic id of your guidelines here */
AND post_number = /* this will probably be 1 since I suspect it's the only thing there */
AND msecs > 10000 /* they've looked at it for more than 10 seconds */
Works, thanks! Though this probably isn’t the ideal solution, n the interest of giving back to the community, here’s our multipost version.
SELECT post_timings.user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
JOIN (
SELECT post_timings.user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
JOIN (
SELECT post_timings.user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
WHERE topic_id = 206
AND post_number = 1
AND msecs > 10000
) a ON a.user_id = post_timings.user_id
WHERE topic_id = 1066
AND post_number = 1
AND msecs > 10000
) b ON b.user_id = post_timings.user_id
WHERE topic_id = 1043
AND post_number = 1
AND msecs > 10000
SELECT count(*), user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
WHERE
( topic_id = 206 AND post_number = 1 AND msecs > 10000) OR
( topic_id = 1066 AND post_number = 1 AND msecs > 10000) OR
( topic_id = 1043 AND post_number = 1 AND msecs > 10000)
GROUP BY user_id
HAVING count(*) = 3
Edit: Changed since it was pointed out to me that the original wouldn’t have worked.
SELECT count(*), user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
WHERE post_number = 1
AND msecs > 10000
AND ( topic_id = 206 OR topic_id = 1066 OR topic_id = 1043 )
GROUP BY user_id
HAVING count(*) = 3
I’m no SQL expert, just seems like it should be possible given the duplication in the original query.
Yeah, not sure what a good read time is, but 10 seconds seems okay.
I would also assume the first post is the focus.
Also couldn’t this be simplified a bit more? (Again naive SQL assumptions)
SELECT count(*), user_id, CURRENT_TIMESTAMP AS granted_at
FROM post_timings
WHERE post_number = 1
AND msecs > 10000
AND topic_id IN ( 206, 1066, 1043 )
GROUP BY user_id
HAVING count(*) = 3