MYSQL 進制轉換 [ CONV( N, from_base, to_base) ]
MYSQL 進制轉換 [ CONV( N, from_base, to_base) ]
語法:
CONV( N, from_base, to_base)
ex:[10->16]進制
SELECT cir.timestamp AS timestamp,cir.status AS status,rs.name AS n_status,cir.door_index AS door_index,CONV(cir.serial_number,10,16) AS serial_number,cir.card_unique_identifier AS card_unique_identifier FROM controller_io_record AS cir,record_status AS rs WHERE (cir.status=rs.id) AND (cir.card_unique_identifier='') SELECT cir.timestamp AS timestamp,cir.status AS status,rs.name AS n_status,cir.door_index AS door_index,CONV(cir.serial_number,10,16) AS serial_number,cir.card_unique_identifier AS card_unique_identifier FROM controller_io_record AS cir,record_status AS rs WHERE (cir.status=rs.id) AND (cir.card_unique_identifier<>'')
One thought on “MYSQL 進制轉換 [ CONV( N, from_base, to_base) ]”
2018/09/16
base 70萬筆資料
base
SELECT cir.timestamp AS timestamp,cir.status AS status,cir.door_index AS door_index,CONV(cir.serial_number,10,16) AS serial_number,cir.card_unique_identifier AS card_unique_identifier FROM controller_io_record AS cir;
欄位紀錄: 時間,狀態,控制器SN(16進位),卡號
base 計算筆數
SELECT COUNT(*) FROM (SELECT cir.timestamp AS timestamp,cir.status AS status,cir.door_index AS door_index,CONV(cir.serial_number,10,16) AS serial_number,cir.card_unique_identifier AS card_unique_identifier FROM controller_io_record AS cir) AS base; [0.6961S]