我有兩個表,我想編寫一個查詢,將給予我這樣做的最高和最低值,但它的顯示''一些錯誤附近工會'... (使用union就是這樣)在SQL如何找到最低和最高值
select TOP 1 od.productid,od.unitprice,totalprice=(od.unitprice-od.discount) from orderdetails od
inner join
orders o
on od.orderid=o.orderid
where o.orderdate between '10/7/1997' and '10/14/1997'
order by totalprice asc
union
select TOP 1 od.productid,od.unitprice,totalprice=(od.unitprice-od.discount) from orderdetails od
inner join
orders o
on od.orderid=o.orderid
where o.orderdate between '10/7/1997' and '10/14/1997'
order by totalprice asc
我在做什麼錯?
[**你嘗試過什麼?**](http://whathaveyoutried.com) – 2012-07-25 05:27:19