Hi,
In a sql based query, I need to check that the persons I select from data should have a cell phone with area code 256. How do we check this? I have cell phone numbers as BIGINT.
Hi,
In a sql based query, I need to check that the persons I select from data should have a cell phone with area code 256. How do we check this? I have cell phone numbers as BIGINT.
I assume you mean MySql 5.1.
In any case,
Select * from persons where persons.cellphonenumber % 10000000 == 256
Or something similar with the modulus operator.
something like this:
select if(substr( convert(<your cell phone field>, char(20)), 1,3) = '256', 1, 0)
select if(substr( convert(25746744073709551615, char(20)), 1,3) = '256', 1, 0)
or you could use like:
select if(convert(25646744073709551615, char(20)) like '256%', 1, 0)