select gfcode as drugCode sumsfqty_qualified - sfqty_waitoutas stock maxgfname_com as fname_comfrom com_stock s t_goods g where sfgoods_id = gfid and gfcode is not null and gfcode != --sfqty_bulk 0-
查询t_goods和com_stock两个表中,商品ID和商品编码不为空且不为" "的记录,计算库存总量,并获取商品名称,最后按商品编码分组,只返回库存总量大于0的记录。
原文地址: https://www.cveoy.top/t/topic/bYNX 著作权归作者所有。请勿转载和采集!