支付中心資料庫查詢語句 個人記錄

2021-06-26 17:14:19 字數 1324 閱讀 1660

select id  'id號',

sn  '**訂單號',

(select paycenterdb.pay_order.order_id from paycenterdb.pay_order where paycenterdb.pay_order.out_trade_no = saledb.pay_order.sn) '支付中心訂單號',

member_id  '使用者id',

(select guangchang.users.nike from guangchang.users where guangchang.users.id= saledb.pay_order.member_id)as '使用者名稱',

(select name from pay_item where pay_item.id=pay_order.item_id)as '商品名',

(select attr_name from pay_attr where pay_attr.id=pay_order.attr_id)as '屬性名',

count as '數量',

base_price as '單價',

total_price as '總價',

from_unixtime(create_time) as '下單時間',

(case pay_status when 1 then '已支付' when 0 then '未支付' when 2 then '已過期' end)as'支付狀態',

(case to_status when 0 then '未發貨' when 1 then '已發貨'  end)as '發貨狀態',

(case pay_type when 'alipay' then '支付寶-pc版' when 'epaylinks' then '網上銀行-pc版' when 'epaylinkswap' then '網上銀行-m版'  when 'alipaywap' then '支付寶-m版'  end)as '支付型別',

(select field_value from pay_order_extend where pay_order_extend.order_id=pay_order.id and extend_id=16)as '手機',

from_unixtime(pay_time) as '支付時間',(select paycenterdb.pay_order.updated_remark from paycenterdb.pay_order where paycenterdb.pay_order.out_trade_no = saledb.pay_order.sn)as '票號資訊'

from pay_order 

order by create_time desc

MySQL資料庫查詢語句記錄學習

以上圖資料庫表為例,表名moncenter data air,表結構如下圖 1.查詢今天資料指令 select datatime from moncenter data air where to days datatime to days now 2.查詢昨天資料指令 select datatime...

資料庫查詢語句

表示要查詢所有列 select from t student 查詢所有人的姓名資訊 select stu name from t student 查詢張乾的手機號和位址 select stu mobile,stu address from t student where stu name 張乾 查詢...

資料庫 查詢語句

隱式連線 select coursename,teachername from courses inner join teachers on courses.teacherid teahcer.teacherid 等價於顯式連線 select coursename,teachername from ...