Hello,
Bear with me (not had much sleep last night), pls see following ddl,
dml and comments for what is desired, I don't have a problem getting
desired result(s), however, I'm wondering if there's another (better)
solution than UNION operator in this case. TIA.
-- DDL
CREATE TABLE #TMP (col varchar(10));
-- DML
insert into #TMP
values('A124');
insert into #TMP
values('A127');
insert into #TMP
values('A12728');
insert into #TMP
values('A17282');
insert into #TMP
values('BCD');
insert into #TMP
values('BCD');
insert into #TMP
values('CDSS');
insert into #TMP
values('DS');
insert into #TMP
values('YUUEI');
-- goal: get one row with col data starting with 'A' and distict rows
for the rest
select top 1 col
from #TMP
where col LIKE 'A%'
UNION
select distinct col
from #TMP
where col NOT LIKE 'A%'