SELECT thread.*
,
social_forum.title AS social_forum_title, social_forum.user_id AS social_forum_user_id, social_forum.style_id AS social_forum_style_id,
poll.*,
forum.*, 21 AS itemtypeid, thread.thread_id AS itemid
FROM xf_thread AS thread
LEFT JOIN xf_social_forum AS social_forum ON
(social_forum.social_forum_id = thread.social_forum_id)
LEFT JOIN xf_poll AS poll ON
(poll.content_type = 'thread' AND content_id = thread.thread_id)
INNER JOIN xf_forum AS forum ON
(forum.node_id = thread.node_id)
WHERE (((thread.node_id IN (13, 43, 173, 312, 480, 184, 426, 177, 209, 176, 459, 458, 461, 314, 460, 190, 428, 429, 391, 430, 174, 69, 191, 419, 301, 127, 68, 57, 129, 152, 368, 153, 130, 164, 369, 167, 154, 165, 370, 168, 155, 166, 371, 169, 128, 156, 372, 163, 171, 170, 274, 55, 146, 180, 54, 143, 462, 304, 305, 302, 351, 309, 342, 308, 306, 381, 53, 307, 310, 41, 192, 193, 75, 473, 71, 42, 60, 138, 45, 438, 481, 56, 424, 282, 284, 417, 280, 288, 420, 281, 425, 440, 441, 467, 468, 469, 470, 471, 472, 463, 464, 465, 466, 196, 279, 221, 223, 224, 277, 297, 354, 293, 355, 356, 296, 294, 222, 295, 357, 358, 359, 217, 225, 360, 216, 361, 362, 218, 363, 220, 375, 278, 219, 273, 211, 212, 213, 214, 215, 228, 227, 237, 238, 229, 239, 230, 240, 231, 241, 242, 243, 232, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 236, 264, 265, 266, 267, 233, 234, 268, 269, 235, 270, 271, 272, 290, 292, 291, 226, 474, 70, 195, 475, 85, 51, 74, 188, 142, 394, 476, 39, 477, 478, 49, 482, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 483, 335, 17, 433, 435, 187, 38, 66, 64, 186, 185, 65, 67, 328, 380, 434, 319, 437, 84, 431, 330, 27, 379, 402, 401, 400, 352, 29, 333, 407, 3, 18, 285, 19, 136, 135, 88, 326, 286, 325, 7, 331, 409, 410, 411, 412, 106, 26, 414, 418, 479, 413, 405, 62, 125, 416, 415, 22, 283, 24, 80, 92, 119, 446, 50, 20, 289, 30, 422, 324, 40, 175, 443, 52, 321, 118, 76, 93, 117, 32, 320, 353, 35, 408, 36, 421, 322, 23, 25, 329, 8, 79, 332, 28, 33, 406, 161, 123, 395, 396, 403, 397, 124, 162, 334, 398, 404, 399, 287, 432, 21, 336, 377, 445, 89, 423, 323, 91, 90, 327, 392, 393, 37, 107, 132, 134, 172, 133, 46, 148, 147, 58, 315, 316, 318, 317, 343, 344, 150, 345, 346, 110, 59, 159, 149, 111, 115, 86, 61, 108, 114, 158, 109, 157, 112, 82, 87, 14, 208, 210, 389, 447, 347, 442, 47, 200, 204, 207, 206, 203, 202, 205, 197, 348, 349, 198, 201, 350, 199, 122, 121)))) AND (thread.discussion_type = 'poll')
ORDER BY thread.post_date DESC
LIMIT 1