Hi,
I have the following table and want to look for a phone extension in column Poste_Autorise but only return a true value if something is found.
I did this query that does not work because in my app if there's an empty value between the %% it does return 1 anyway.
I want the LIKE statement to return 0 if the extension is not found.
Return 1
Return 1 (I want it to return 0 because the extension do not exist in Poste_Autorise)
My table:
I have the following table and want to look for a phone extension in column Poste_Autorise but only return a true value if something is found.
I did this query that does not work because in my app if there's an empty value between the %% it does return 1 anyway.
I want the LIKE statement to return 0 if the extension is not found.
SQL:
SELECT COUNT(1)FROM Poste_Restriction WHERE Poste_Autorise LIKE '%2243%' AND Poste_Appel_Entrant = '2882'
Return 1
SQL:
SELECT COUNT(1)FROM Poste_Restriction WHERE Poste_Autorise LIKE '%%' AND Poste_Appel_Entrant = '2882'
Return 1 (I want it to return 0 because the extension do not exist in Poste_Autorise)
My table: