两条记录合并一条的 sql

时间:2022-12-21 21:41:00
select          eu.ID,
eu.UID,
eu.ID_NO,
eu.USER_NICK,
eu.USER_NAME,
eu.PWD_DIGEST,
eu.PWD_SALT,
eu.SEX,EMAIL,
eu.PHONE,
eu.STATUS,
eu.USER_TYPE,
eu.REG_SRC_ID,
eu.USER_LOC,
eu.GMT_BIRTH,
eu.GMT_CREATE,
eu.GMT_MODIFY,
et1.test_count,
et2.last_time


from EH_USER_INFO eu
inner join EH_USER_ORG_MAP euo on eu.uid = euo.uid
inner
join EH_ORGANIZATION eo on euo.org_id = eo.id
left join
EH_LOGON_INFO el on
eu.uid = el.uid and el.logon_type =
'DEFAULT' and
el.status = 'E'

       left join eh_user_test_stat_info et1 on
                    et1.uid=eu.uid and et1.stat_type='all_count'
         
                left join eh_user_test_stat_info et2 on
                   et2.uid=eu.uid and  et2.stat_type='last_time'
        
where  
eu.uid notnull


           order by eu.gmt_create desc 


                limit 10
OFFSET 0