sql query skill

https://www.w3resource.com/sqlite/sqlite-select-query-statement.php


 /*
 
 
 SELECT ChipID FROM "tb_XM1004_B_DWL_t2_f" WHERE ChipID!=0 AND T2_ChipResult!='DB_T2_T1ErrAddrNum_OutOfRange';


 CAST(ChipID AS CHAR(24))

 CHAR(ChipID)
 
 BIGINT('111')
 
 DIGITS(ChipID)
 Dec(ChipID)
 HEX(X)
 
 SELECT CONVERT(VARBINARY(50), 123456)
 
http://www.cnblogs.com/gaizai/p/4001016.html
concat(HEX(ChipID))

和c 一样, 记得 X位数 之前要加0 , 比如 printf('%018X', V)  =>18个字符的16进制
printf('%08X', V)  

//多个参数
printf("%08X,%08X,%08X", V1,V2,V3)  




SELECT printf("%016X",ChipID),T1_ChipResult FROM "tb_XM1004_B_DWL_t1_f" WHERE ChipID<>0 AND T1_ChipResult <> "Status_T1_ErrAddrNum_OutOfRange" ORDER BY ChipID


SELECT printf("%X",ChipID),T2_ChipResult FROM "tb_XM1004_B_DWL_t2_f" WHERE ChipID<>0 AND T2_ChipResult <> "DB_T2_T1ErrAddrNum_OutOfRange" AND T2_ChipResult <> "DB_T2_MergeErrAddrNum_OutOfRange" ORDER BY ChipID



 !=  和<> 都是不等于



 */

SELECT printf('%X', ChipID),*  FROM "tb_XM1004_B_DWL_t2_f" WHERE ChipID != 0 AND T2_ChipResult != 'DB_T2_T1ErrAddrNum_OutOfRange';




SELECT printf("%X",ChipID),T2_ChipResult FROM "tb_XM1004_B_DWL_t2_f" WHERE ChipID<>0 AND T2_ChipResult <> "DB_T2_T1ErrAddrNum_OutOfRange" AND T2_ChipResult <> "DB_T2_MergeErrAddrNum_OutOfRange" ORDER BY ChipID



SELECT printf("%X",ChipID), printf("%X",BatchID) FROM "tb_XM1004_B_DWL_t1_p" ORDER BY ChipID LIMIT 1;


SELECT COUNT(ChipID),printf("%X",ChipID), printf("%X",BatchID), T1_ChipResult FROM "tb_XM1004_B_DWL_t1_f" GROUP BY ChipID ORDER BY ChipID;




SELECT printf("%X,%X,%X,%X",ChipID,BatchID,T1_Analog1_V12,T1_Analog2_V05) FROM "tb_XM1004_B_DWL_t1_f";


posted @ 2019-11-18 19:19  scott_h  阅读(175)  评论(0编辑  收藏  举报