SELECT * FROM tbl_custum_advertisement WHERE 'group' = 1
SELECT * FROM `tbl_custum_advertisement` WHERE `group`=1
Asked
Active
Viewed 41 times
3 Answers
0
You first query is comparing a literal 'group'
to a literal 1
.
Your second query is comparing the value of the field group
to a literal 1
.
MySQL uses backticks to indicate fields, and single quotes to indicate strings (or double quotes, actually)

pala_
- 8,901
- 1
- 15
- 32
0
Quotes ('
) and backticks
`
are different.
'blah'
is a literal string. But
`blah`
is a column (or other) name.
'group' = 1
is never true. But a column named group
might contain the value 1
, so
`group` = 1
could possibly be true.

elixenide
- 44,308
- 16
- 74
- 100
0
Backticks (`) are to be used as an identifier for tables and columns
Single quotes (') should be used for strings and string comparisons
Please refer to this question for further understanding
When to use single quotes, double quotes, and backticks in MySQL

Community
- 1
- 1

Rohit Bandooni
- 361
- 4
- 14