原生SQL写法:
select case
when total > max then 2
when total < min then 1
else 0
end
from ta
PHP(ThinkPHP)写法:
$data = Db::connect('data')->name("pay-{$date}")
->where($where)
->order('id', 'desc')
->limit(($page - 1) * 50, 50)
->field('id,case when payType=1 then "支付宝" when payType=2 then "微信" else "未知" end as payType')
->select();

博客提及了原生SQL的写法以及PHP(ThinkPHP)的写法,聚焦于信息技术领域中数据库操作相关的代码书写方式。
1164

被折叠的 条评论
为什么被折叠?



