case when (logo=0 and name!='')or (logo=1 and name='') then ID else ... end
SELECT * FROM ASso_member WHERE [logo] in ('0','1') and picname is not null ORDER BY [logo],case when picname ='' then 1 else 0 end
select '第一类' union all select id from where logo=0 and name!='' group by id union all select '第二类' union all select id from where logo=1 and name='' group by id
select '第一类' union all select id from student where logo=0 and name!='' group by id union all select '第二类' union all select id from student where logo=1 and name='' group by id
*
FROM
ASso_member
WHERE
[logo] in ('0','1') and
picname is not null
ORDER BY
[logo],case when picname ='' then 1 else 0 end
select '第一类'
union all
select id from where logo=0 and name!='' group by id
union all
select '第二类'
union all
select id from where logo=1 and name='' group by id
union all
select id from student where logo=0 and name!='' group by id
union all
select '第二类'
union all
select id from student where logo=1 and name='' group by id