> >
> > Just eliminate the strings added before high_count values...
> >
> >
select code1, code2, "Code1_High"+str(max(code1)) as high_count from mytable ;
> > union ;
> > select code1, code2, "Code2_High"+str(max(code2)) as high_count from mytable
> >
> > CriZ (,")
> >
> > "Everyone is entitled to their own opinion, but not their own facts."
>
> That is no high COUNT that is just MAX(Code). Also you missed some GROUP BY clauses and they are mandatory when you use aggregate functions.
>
> -----------------
> Borislav Borissov
>
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller>
The only thing normal about database guys is their tables.I forgot somethin'
select "Code1" as Code_Group, code1 as Code, count(code1) as high_count from mytable group by code1 ;
union all;
select "Code2" as Code_Group, code2 as Code , count(code2) as high_count from mytable group by code2 into cursor cur_Temp
select top 2 * from cur_Temp order by high_count desc
CriZ (,")
"Everyone is entitled to their own opinion, but not their own facts."