select distinct goodsid,barcode,depotid,goodsname from sa_sale where depotid='11' order by selldate
這句話執(zhí)行的時候就有錯誤 ,但把排序換成 order by goodsid 或其它 barcode,depotid,goodsname的時候均沒有錯誤,到此可能大家都想到了,因為 selldate不在查詢結果字段中,而且這個語句是distinct語句。所以會出現(xiàn)這個錯誤
下邊給出正確的解決辦法:
select goodsid,barcode,depotid,goodsname from
(select distinct goodsid,barcode,depotid,goodsname,selldate from sa_sale where depotid='11' )
order by selldate
問題解決,呵,拿來寫在我的blog中,做個記錄。也希望對大家有所幫助。
新聞熱點
疑難解答
圖片精選