select uu.id,
uu.name AS name,
ur.company_name,
uu.email,
uu.status,
uu.last_login,
uu.admin_type_id,
ab.ab_testing_user_id,
ab.ab_testing_status,
ur.premium_player,
ur.additional_notes,
uu.is_preferred_vendor,
uu.created_on,
uu.created_city,
uu.created_country,
CONCAT_WS(', ',
uu.created_city,
uu.created_country) AS geo_location,
ur.primary_contact AS phone_number,
ifnull(ta.totalapplicationcount,0) as totalapplicationcount,
ifnull(rr.agencyreviewcount,0) as agencyreviewcount,
ifnull(ts.totalsubmissioncount,0) as totalqualifiedsubmission,
ifnull(ac.acc,0) as acc
from user_user uu join game_user ur on ur.user_id=uu.id left join ab_testing ab on ab.ab_testing_user_id=uu.id left join login_log ll on ll.login_user_id=uu.id left join roles_position_closure rpc on rpc.user_id=uu.id left join industry_position_closure ipc on ipc.user_id=uu.id left join (SELECT
COUNT(ja.id) AS matchcount,
frm.player_roles_id,
jr.referby_user_id,
ja.apply_date
FROM
functional_roles_map frm
JOIN
matchs_post jp ON jp.match_functional_id = frm.match_post_functional_roles
JOIN
match_applied ja ON ja.match_post_id = jp.id
join match_refer_to_member jrm on jrm.id=ja.referred_by
join match_refer jr on jr.id = jrm.rid
WHERE
ja.applied_source != '1'
GROUP BY frm.player_roles_id , jr.referby_user_id) fp on fp.referby_user_id=uu.id
left join
(select
count(ja.id) as totalapplicationcount,
uu.id as player_id,
ja.apply_date
from
user_user uu
join match_refer jr on
jr.referby_user_id = uu.id
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on ja.referred_by=jrm.id
group by
uu.id) as ta on ta.player_id=uu.id
left join
(select
count(ja.id) as agencyreviewcount,
jr.referby_user_id as player_id
from
user_user uu
join match_refer jr on
uu.id = jr.referby_user_id
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on
ja.referred_by = jrm.id
where
ja.admin_review = '1'
and ja.status != '5'
group by
jr.referby_user_id) as rr on rr.player_id=uu.id
left join (select
count(ja.id) as totalsubmissioncount,
uu.id as player_id,
ifnull(ja.admin_submitted_on,ja.apply_date) as admin_submitted_on
from
user_user uu
join match_refer jr on
jr.referby_user_id = uu.id
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on ja.referred_by=jrm.id
where ja.admin_review='2'
group by
uu.id) as ts on ts.player_id=uu.id
left join (select uu.id,
ceil((((
select
count(ja.id)
from
match_refer jr
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on
ja.referred_by = jrm.id
where
jr.referby_user_id = uu.id
and ja.admin_review = '2'))/((
select
count(ja.id)
from
match_refer jr
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on
ja.referred_by = jrm.id
where
jr.referby_user_id = uu.id)))* 100 )as acc
from
user_user uu
where
uu.user_member_type_id = '2' ) as ac on ac.id=uu.id
left join successful_placment sp on sp.user_id=uu.id
where uu.user_member_type_id='2' and uu.status in('1','2') and ( uu.id!='' and ( ts.totalsubmissioncount > '0' and ( ts.admin_submitted_on >= '2019-01-01' and ts.admin_submitted_on <= '2019-01-31' ) ) ) group by uu.id
当我在where子句中包含此( ( ts.admin_submitted_on >= '2019-01-01' and ts.admin_submitted_on <= '2019-01-31' ))
条件时,我会获得35条记录。
(select
count(ja.id) as totalsubmissioncount,
uu.id as player_id,
ifnull(ja.admin_submitted_on,ja.apply_date) as admin_submitted_on
from
user_user uu
join match_refer jr on
jr.referby_user_id = uu.id
join match_refer_to_member jrm on
jrm.rid = jr.id
join match_applied ja on ja.referred_by=jrm.id
where ja.admin_review='2' and ( ( ja.admin_submitted_on >= '2019-01-01' and ja.admin_submitted_on <= '2019-01-31' ))
group by
uu.id) as ts
当我在子查询中包含此条件时,我获得了110条记录。
我想获得110条记录,条件是仅包含在where子句中。