我们在查询数据库时
有时候可能需要直接用原生的sql来查询数据库,这样比较简单粗暴
以下为thinkphp5执行原生的sql语句
```
0 and pay_type!=3 union select sum(total_price) as total_price from goods_order_history where username='$username' and goods_type in(2,3) and pay_time>0 and pay_type!=3) a";
echo $sql;
$third_party = Db::name('user')->query($sql);
print_r($third_party[0]['total_price']);
...
...
...
?>
```