0

代码 = 00000000005555

第二个选项代码 = 00000000000555

嗨,我正在尝试找出与 php 的 ltrim() 相同的功能

SELECT * FROM db1.stock JOIN db2.prodinfo ON replace(db2.prodinfo.code,0000000000,'') = replace(db1.stock.code,0000000000,'') WHERE db1.stock.InvNo ='12' and db2.prodinfo.Cat = 'super'

我朗姆酒这个暂时的。因为在上面的示例中,零可能是增加和减少。我只想在此查询中删除零

谢谢

4

1 回答 1

1

尝试将其转换为数字,

SELECT * 
FROM db1.stock JOIN db2.prodinfo ON 
          CAST(db2.prodinfo.code AS SIGNED) = CAST(db1.stock.code AS SIGNED) 
WHERE db1.stock.InvNo ='12' and db2.prodinfo.Cat = 'super'

或者

SELECT * 
FROM db1.stock JOIN db2.prodinfo ON 
CAST(db2.prodinfo.code AS DECIMAL(15,0)) = CAST(db1.stock.code AS AS DECIMAL(15,0)) 
WHERE db1.stock.InvNo ='12' and db2.prodinfo.Cat = 'super'
于 2012-11-09T17:10:59.350 回答