写sql的老手~鸿池

今天再鸿池后面看着他写sql,啪啪啪打了一大串,这么长的一串sql要是我以前看起来根本就是不是我能企及的。可能你们看到我这样说觉得很可笑,个人能力不高,不过贵在努力学习

因为之前工作中涉及sql的操作并不多,说起来有些羞愧,这尼玛还好意思舔着脸和别人说工作经验xx年,工作项目xxxxxx。看看人家这写码的素质~,自愧不如啊~

首先,鸿池先在sql工具里写了第一段的sql作为a取出自己需要的字段检查正确性作为a,然后再在sql工具中写另一段sql取出自己需要的字段检查正确性作为b,然后再取出自己需要的字段。

废话不说上代码~~

select a.voucher_value, a.voucher_number as exp_voucher, date(a.issue_time) as exp_issue_date, a.expiry_date as exp_expiry_date
    , a.expiry_grace_date as exp_expiry_grace_date
    , b.voucher_number as new_voucher, date(a.replace_time) as replace_date
    , b.expiry_date as new_expiry_date
    , b.expiry_grace_date as new_expiry_grace_date
    from (
     select a.expired_voucher_id, b.voucher_value, concat(prefix, voucher_text, suffix) as voucher_number, 
     max(c.action_time) as issue_time, b.expiry_date
     , DATE_ADD(b.expiry_date, INTERVAL $this->_grace_period_days DAY) AS expiry_grace_date
     , a.replace_time
     from $this->_voucher_replace_details a, $this->_voucher b, $this->_voucher_action c
     where a.expired_voucher_id = b.voucher_id
     and b.voucher_id = c.voucher_id
     and c.action_id in ('$issue_action_id', '$issue_action_id2', '$issue_action_id3')
     $value_clause
     AND  (a.replace_time BETWEEN '$quarter_start_date 00:00:00' AND '$quarter_end_date 23:59:59' )
     group by b.voucher_id
    ) a,
    (
     select a.expired_voucher_id, b.voucher_value, concat(prefix, voucher_text, suffix) as voucher_number, 
     max(c.action_time) as issue_time, b.expiry_date
     , DATE_ADD(b.expiry_date, INTERVAL $this->_grace_period_days DAY) AS expiry_grace_date
     from $this->_voucher_replace_details a, $this->_voucher b, $this->_voucher_action c
     where a.new_voucher_id = b.voucher_id
     and b.voucher_id = c.voucher_id
     and c.action_id in ('$issue_action_id', '$issue_action_id2', '$issue_action_id3')
     AND  (a.replace_time BETWEEN '$quarter_start_date 00:00:00' AND '$quarter_end_date 23:59:59' )
     group by b.voucher_id
    ) b
    where a.expired_voucher_id = b.expired_voucher_id
    ORDER BY 2 ASC

留念学习,理清逻辑,其实你也可以做到~~

ie兼容性 真真的坑爹啊~

早上调试到现在,2个问题

1.点击 jquert html 到id里的buttom 不触发onclick事件

再chrome里是有效的,在ie和firfox下无响应

最后解决的办法是 把onclick事件放在了包裹buttom的span里

2.点击request replacement按钮的时候无效,ie报错(SCRIPT1014:无效字符)

上网查阅一番,说是后台ajax返回的数据不是json格式的,胆识我在后台的文件反复检查返回回来的数据都是

会jsonencode再echo出来的。然后找了半天才发现做post的时候sub的值是通过jquery获取的就是

$('#xxxx').val() 这种形势,发现之后果断换掉,直接传递submission_id进函数,问题解决。

 

至此从早上10点一直调试到现在 ,坑爹啊~~~