问题描述
- sql语句中出现了这样的错误怎么解决呀!
-
String sql = "select tab.nid,tab.tid,tab.pdate,tab.ptype,tab.psysdate,tab.pprice,tab.prodname,"
+ "tab.auditstatus,tab.pnumber,tab.zprice,tab.companyId,tab.sno,tab.soeno,tab.provname from "
+ "(select n.id nid,t.id tid,n.P_DATE pdate,n.TYPE ptype,n.P_SYS_DATE psysdate,sum(t.P_PRICE) pprice,"
+ "s.PRODNAME prodname,n.AUDIT_STATUS auditstatus,sum(t.P_NUMBER) pnumber,"
+ "sum(Z_PRICE) zprice,n.COMPANY_ID companyId,s.no sno,s.oeno soeno,jtp.provname provname "
+ "from jxc_t_purchase as n "
+ "right join jxc_t_purchase_detail as t on t.P_PURCHASE_ID=n.id "
+ "left join jxc_t_products as s on s.id=t.P_WARES_ID "
+ "left join jxc_t_providers jtp on s.PROVIDER_ID = jtp.id "
+ "left join jxc_t_outbound_info jto on n.TYPE = jto.type "
+ "group by n.id desc ) tab where 1=1 ";
出现了这样的错误!Unknown column 'n.TYPE' in 'field list'
解决方案
解决方案二:
jxc_t_purchase 这张表里没有 TYPE 字段 , 检查下那张表 ,TYPE是不是大写的
解决方案三:
表中列名不存在导致的。。
解决方案四:
n.TYPE字段不存在导致
解决方案五:
不知道列'n.TYPE,你看看是不是写错了
时间: 2024-11-01 00:40:25