一般情况下,这两个语句是不能同时使用的,但是可以通过group by的语句来规避SQL报错。
select OLORD from OpenQuery(APPDEV, 'select * from ATDATA.I3ORDLP1')
where I3SEQ = 0 and I3UPL != 'Y'
group by OLORD
order by min(I3AUTS);
这样就可以得到想要的结果。
Reference: http://weblogs.sqlteam.com/jeffs/archive/2007/12/13/select-distinct-order-by-error.aspx