mysql的if null 的用法

       <!-- 查询 分页查询 -->
    <select id="queryByPageList" resultMap="weixinActivityResult" parameterType="com.j1.base.page.Pageable"> 
         SELECT  wa.weixin_id, wa.group_price, wa.weixin_name, wa.minimum_join_member_num , wa.banner_img_url,  wa.start_time,  wa.end_time, wa.discount_lab, wa.begin_wait_time,  wa.is_status, wa.order_by
           ,(
            SELECT COUNT(wag.id)
            FROM weixin_activity_goods wag
            WHERE wag.is_delete = 'N' AND wag.weixin_activity_id = wa.weixin_id) AS choose_n
              from weixin_activity wa
          <include refid="modelwheresqlpage" />
          ORDER BY order_by ASC , ifnull(wa.edit_time,wa.add_time) DESC
         
        <include refid="limitsql" />
    </select>

select  * from HWG_HOT_BRAND  s order by s.SORT_BY asc, nvl(,s.add_time,s.EDIT_TIME)  asc;
 

 

posted @ 2017-03-29 13:05  小啊菜鸡  阅读(1289)  评论(0编辑  收藏  举报