select col1
from table1 group by col1 having count(col1)=1
union all
select col1
from table1 group by col1 having count(col1)>1
from table1 group by col1 having count(col1)=1
union all
select col1
from table1 group by col1 having count(col1)>1
调试欢乐多
from table1 group by col1 having count(col1)>=1
union
(select col1 from table1 group by col1 having count(col1)>1)如果允许重复的记录,在union 后边加上 all
from table1
group by col1
having count(col1)>=1
select col1
from table1 group by col1 having count(col1)=1
union all
select col1
from table1 group by col1 having count(col1)>1
有星是厉害。
马上结贴