Вот SQL, который выдает вышеупомянутый запрос (Ран отправил вопрос от моего имени). В SQL больше полей, чем в запросе, потому что я упростил запрос при его публикации, удалив условия, которые не имеют отношения к проблеме.
SELECT `twitter_status_relations`.`id` AS t0_r0,
twitter_status_relations
. twitter_status_id
AS t0_r1,
twitter_status_relations
. source_twitter_identity_id
AS t0_r2,
twitter_status_relations
. relation_type
AS t0_r3,
twitter_status_relations
. relation_data
AS t0_r4,
twitter_status_relations
. linked_twitter_identity_id
AS t0_r5,
twitter_status_relations
. user_id
AS t0_r6,
twitter_status_relations
. linked_member_id
AS t0_r7, members
. id
AS t1_r0, members
. user_id
AS t1_r1, members
. name
AS t1_r2,
members
. email
AS t1_r3, members
. member_rating
AS t1_r4,
members
. created_at
AS t1_r5, members
. updated_at
AS t1_r6,
members
. merged_with_member_id
AS t1_r7, members
. engage_rating
AS t1_r8, members
. support_rating
AS t1_r9,
members
. user_engage_rating
AS t1_r10,
members
. user_support_rating
AS t1_r11,
members
. influence_rating
AS t1_r12, members
. twitter_username
AS t1_r13, members
. lead_rating
AS t1_r14,
members
. follow_rating
AS t1_r15, members
. unfollow_rating
AS
t1_r16, members
. followers_count
AS t1_r17, members
. hidden
AS
t1_r18 ОТ twitter_status_relations
ВЛЕВО НАРУЖНОЕ СОЕДИНЕНИЕ members
ВКЛ
members
.id = twitter_status_relations
.linked_member_id ГДЕ
(twitter_status_relations
. user_id
= 1 И
twitter_status_relations
. relation_type
IN (
«упоминание», «ответ», «полученный_дм», «ретвит», «ссылка», «термин», «хэштег»)
И twitter_status_relations
. linked_member_id
IN (
83995,128457,21421,138316,128455,97475,128453,436231,82236,441208,138564,138337,436223,436222,441093,21194,441088,441092,438998,442752,138331,138327,138325,444897,9277, 12,509521,13,15,534511,7606,7447,200,7,4,17200,5,652302,1,5536,18770,652301,214082,150870,436228,81204,436225,662513,138608,138338
)) И twitter_status_relations
.id IN (8304, 26493, 113492, 113638,
1, 6, 41213, 113493, 20, 26173) GROUP BY
twitter_status_relations.linked_member_id ORDER BY
members.member_rating