发布网友 发布时间:2024-10-24 13:12
共1个回答
热心网友 时间:2024-11-20 04:02
sql 在连接时注意加空格
String sql = "select a.fMateralID,a.fMaterialName,a.fMaterialType,a.fSpecModel,a.fMaterial "
+ "from tblMaterial a join "
+ "(select fMaterialName,fMaterialType,fSpecModel,fMaterial,count(1) as cnt from tblMaterial "
+ "group by fMaterialName,fMaterialType,fSpecModel,fMaterial) b "
+ "on a.fMaterialName=b.fMaterialName and a.fMaterialType=b.fMaterialType "
+ "and a.fSpecModel=b.fSpecModel and a.fMaterial=b.fMateria l"
+ "where b.cnt>1 ";