I write a sales query function module, but in the test when the bar code/code/warehouse conditions sorted by the time there is no error, as long as the date of the search will have "Ora-01791 is not selected expression" error message, and then view my SQL statements, statements are as follows:
Select distinct goodsid,barcode,depotid,goodsname from Sa_sale where depotid= ' one ' ORDER by selldate
There are errors in the execution of this sentence, but there are no errors when you change the sort to order by Goodsid or other barcode,depotid,goodsname, because Selldate is not in the query result field, And this statement is a distinct statement. So there's this error.
The correct solution is given below:
Select Goodsid,barcode,depotid,goodsname from
(Select distinct goodsid,barcode,depotid,goodsname,selldate from Sa_sale where depotid= ' 11 ')
ORDER BY Selldate
Problem solving, oh, take it to write in my blog, make a record. Also hope to help everyone.