1

I'm writing a query in mySQL to find a specific ID but the query returns data even when the conditions do not true.

SELECT `id`,`VCNCID` 
FROM `combinedsms`
WHERE `VCNCID`="737s"

As I do not have 737s in my table, so the result should be NULL.

But it returns all entries with 737 instead.

enter image description here

4
  • 2
    What is the dataType of column VCNCID ? Commented Apr 20, 2019 at 8:36
  • @Rakesh Jakhar, VCNCID dataType is int(11) Commented Apr 20, 2019 at 8:39
  • 2
    Then it's going to ignore the 's'. Commented Apr 20, 2019 at 8:40
  • Refer to this example too: dbfiddle.uk/… Commented Apr 20, 2019 at 8:45

1 Answer 1

0

For the INT data type you don't need a single quote or double quote, simply try

SELECT id,VCNCID FROM combinedsms WHERE VCNCID=737
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.