我有两个表,我想编写一个查询,将给予我这样做的最高和最低值,但它的显示''一些错误附近工会'... (使用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