Oracle的子查询别名记录

今天看到sql语句懵了,select aaa.* … 一直在找别名为aaa的表,结果只在最后括号外看到了aaa,然后搜索关于oracle的别名问题,没怎么找到,忽然想起来是嵌套查询,可能是子查询的别名?之前没用过。。。先记录一下,再慢慢研究。

部分代码:

select **aaa** .id_card,aaa.identify_date,bb.bio_type from(
			
				SELECT P .id_card,MAX(P .identify_date) as identify_date
				FROM app_task_person AT , unify_identify P
				where P .id_card = AT .id_card
				
				and ('1'!='1'
				<if test="isVein == '1'.toString()">
				 or  p.bio_type='1'
				</if>
				<if test="isFace == '1'.toString()">
				  or(p.bio_type='2' and p.identify_method &lt;&gt; '1')
				  or(p.bio_type='2' and p.identify_method &lt;&gt; '2')
				  or(p.bio_type='2' and p.identify_method &lt;&gt; '3')
				  or(p.bio_type='2' and p.identify_method &lt;&gt; '4')
				 </if>
				 <if test="isFinger == '1'.toString()">
				  or  p.bio_type='3'
				 </if>
				  <if test="isManual == '1'.toString()">
				  or p.bio_type='4'
				  </if>
				  )
				
				<if test="bioType != null and bioType != ''">
					AND p.bio_type = #{bioType}
				</if>
				<if test="beginDate != null and beginDate != ''">
					AND (p.identify_date  BETWEEN
					 TO_DATE(#{beginDateStr},'yyyy-mm-dd hh24:mi:ss') 
					 AND TO_DATE(#{endDateStr},'yyyy-mm-dd hh24:mi:ss') )
				</if>
		
				<if test="taskId != null and taskId != ''">
					AND ( at.task_ids LIKE
					<if test="dbName == 'oracle'">'%,'||#{taskId}||',%'</if>
					<if test="dbName == 'postgre'">'%,'||#{taskId}||',%'</if>
					<if test="dbName == 'mssql'">'%,'+#{taskId}+',%'</if>
					<if test="dbName == 'mysql'">concat('%,',#{taskId},',%')</if>
					OR at.task_id = #{taskId} )
				</if>
				GROUP BY p.ID_CARD
			  )**aaa**
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值