本文主要是介绍查询SQL 人大金仓 与MySQL的区别,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
查询SQL 人大金仓 与MySQL的区别,以若依为例
- 最常见 时间范围
1.人大金仓 Kingbase
<select id="selectUserListByOrgIds" parameterType="SysUser" resultMap="SysUserResult">select u.user_id, u.dept_id, u.nick_name,u.tj_id,u.certificate,u.org_id, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from public.sys_user uleft join sys_dept d on u.dept_id = d.dept_idwhere u.del_flag = '0'<if test="orgIds != null">AND u.org_id in<foreach item="orgId" collection="orgIds" open="(" separator="," close=")">#{orgId}</foreach></if><if test="userName != null and userName != ''">AND u.user_name like concat('%', #{userName}, '%')</if><if test="phonenumber != null and phonenumber != ''">AND u.phonenumber like concat('%', #{phonenumber}, '%')</if><if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->AND to_char(u.create_time,'yyyyMMdd') >= to_date(#{params.beginTime},'yyyy-mm-dd hh24:mi:ss')</if><if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->AND to_char(u.create_time,'yyyyMMdd') <= to_date(#{params.endTime},'yyyy-mm-dd hh24:mi:ss')</if></select>
**2.MySQL**
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user uleft join sys_dept d on u.dept_id = d.dept_idwhere u.del_flag = '0'<if test="userId != null and userId != 0">AND u.user_id = #{userId}</if><if test="userName != null and userName != ''">AND u.user_name like concat('%', #{userName}, '%')</if><if test="status != null and status != ''">AND u.status = #{status}</if><if test="phonenumber != null and phonenumber != ''">AND u.phonenumber like concat('%', #{phonenumber}, '%')</if><if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')</if><if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')</if><if test="deptId != null and deptId != 0">AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))</if><!-- 数据范围过滤 -->${params.dataScope}
这篇关于查询SQL 人大金仓 与MySQL的区别的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!