Du får det samme resultat uden de foranstillede nuller.
Brug heltalsdatatypen til at sammenligne heltalsværdier.
Du kan også konvertere værdierne på farten ved hjælp af cast:
Dit eksempel med Cast:
select if( cast('00160001' as unsigned) between cast('0013001' as unsigned)
and cast('0023000' as unsigned),1,0) as test_a,
if( cast('00200000' as unsigned) between cast('0013001' as unsigned)
and cast('0023000' as unsigned),1,0) as test_b;