Order of the columns doesn't make problem. if you are selecting fileds with aggregate function used in query, you shoud have to do GROUP BY. otherwise non-aggregate problem will occur.
Try the below query, it works
sel A1-A1NC as A1C, A1,B1 from (sel sum(case when IND=1 then 1 else 0 end) A1 from TN)t,TN
sel (sel sum(case when IND=1 then 1 else 0 end) A1 from TN)-A1NC as A1C, B1 from TN
↧