重复数据 怎么只取一条..
本帖最后由 oTests 于 2013-07-10 12:29:51 编辑
SELECT pppp.pztait AS 付款方式, Order_detail.Gds_Name AS 商品名称,
Order_detail.Member_Account AS 用户名, Order_detail.Total_Money AS 总金额,
Order_detail.Discount, [Order].Goods_Pay AS 物流处理费,
[Order].Total_Money AS 付款金额, [Order].Receive_Name AS 姓名,
[Order].Receive_Addr AS 地址, [Order].Receive_Tel AS 电话,
[Order].Deliver_Date AS 订购时间, [Order].No
FROM pppp INNER JOIN
[Order] ON pppp.id = [Order].Pay_Method INNER JOIN
Order_detail ON [Order].No = Order_detail.Order_No
SELECT pppp.pztait AS 付款方式, Order_detail.Gds_Name AS 商品名称, Order_detail.Member_Account AS 用户名, Order_detail.Total_Money AS 总金额, Order_detail.Discount, [Order].Goods_Pay AS 物流处理费, [Order].Total_Money AS 付款金额, [Order].Receive_Name AS 姓名, [Order].Receive_Addr AS 地址, [Order].Receive_Tel AS 电话, [Order].Deliver_Date AS 订购时间, [Order].NoFROM pppp INNER JOIN [Order] ON pppp.id = [Order].Pay_Method INNER JOIN (select * from Order_detail where id in (select max(Order_detail.id) from Order_detail group by order_no)
) Order_detail ON [Order].No = Order_detail.Order_No