首页 > 技术文章 > SQL语句总结

lingluo2017 2017-06-12 18:54 原文

1.将A表中的一个或多个字段插入B表:

insert into tb_orgstruct(product_id,product_name,product_parent_id) SELECT DICTIONARIES_ID,NAME,PARENT_ID from sys_dictionaries

2.mybatis对表格某列求和:

<select id="findPrjNumInputByPoName" parameterType="page" resultType="Float">
		select COALESCE(SUM(ACTUAL_INPUT),0)    "prjNumInput" from
		<include refid="tableName"></include>
		where 
			PO = #{NW_PO_NAME}
	</select>

 

推荐阅读