-1

I have used this query but it doesn't work's with my data, i have attached the snapshot of data in my database as well.

enter image description here

MYSQL Query is as follow's:

SELECT * FROM hotPropertyAlert WHERE FIND_IN_SET('E2', locations) AND ( 'parking' = 'H' )

Once the query is executed didn't return's the result.

enter image description here

Thank's in advance...

Community
  • 1
  • 1
Talha Aslam
  • 101
  • 8

2 Answers2

2

Parking, being a column name, should not be quoted:

SELECT * FROM hotPropertyAlert WHERE FIND_IN_SET('E2', locations) AND ( parking = 'H' )
aynber
  • 22,380
  • 8
  • 50
  • 63
0

Find_in_set return the index of the searche string so you should check if find_in_set is > 0

 SELECT * 
 FROM hotPropertyAlert 
 WHERE FIND_IN_SET('E2', locations) > 0 AND ( parking = 'H' )
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • Comparing to 0 isn't necessary: http://stackoverflow.com/questions/22480418/mysql-request-from-empty-column-and-find-in-set – aynber Aug 04 '16 at 18:30
  • I don't compare if is equal to zero .. but if is greater . .. this mean that the string is in set – ScaisEdge Aug 04 '16 at 18:32