select distinct goodsid,barcode,depotid,goodsname from sa_sale where depotid='11' order by selldate
这句话执行的时候就有错误 ,但把排序换成 order by goodsid 或其它 barcode,depotid,goodsname的时候均没有错误,到此可能大家都想到了,因为 selldate不在查询结果字段中,而且这个语句是distinct语句。所以会出现这个错误
下边给出正确的解决办法:
select goodsid,barcode,depotid,goodsname from
(select distinct goodsid,barcode,depotid,goodsname,selldate from sa_sale where depotid='11' )
order by selldate
问题解决,呵,拿来写在我的blog中,做个记录。也希望对大家有所帮助。
新闻热点
疑难解答