postgreSQL的一些sql语句

来源:互联网 发布:淘宝的结算方式 编辑:程序博客网 时间:2024/05/21 11:17
 <select id="selectBySendUser_replyModifyTime" resultMap="BaseResultMap" parameterType="map" >
    select s1.* ,
    (select s2.MODIFY_TIME from DYRKB_SUGGEST s2 where s2.type=1 and s2.REF_ITEM_GUID = s1.ITEM_GUID order by s2.MODIFY_TIME desc limit 1) as modifyTime
    from DYRKB_SUGGEST s1
    where s1.SEND_USER = #{hashMapQuery.sendUser,jdbcType=VARCHAR} and s1.type=0
    order by modifyTime desc nulls last
    limit #{hashMapQuery.pageSize} offset #{hashMapQuery.from}

  </select>


nulls last:是指将空值的记录排在后面

nulls first:是指将空值的记录排在前面(默认)

原创粉丝点击