sql - How to explode in MySQL and use it in the WHERE clause of the query - MySQL -


i have database table below.

promotion_table

id(int), promotion_name(varchar),......, bungalow_ids(varchar) 

we can add promotion bungalow(23). row added bungalow id below.

1, promotion, ........, 23

but if single promotion added multiple bungalows(23,42) ids saved in bungalow_ids column below.

2, promotion 2, ........, 23 | 42

if user search promotion specific bungalow(23) promotions bungalow should shown in result.

i have query below.

select * promotion_table bungalow_ids = '23' 

it gets 1 rows. 2nd row should shown since there offer. can nt use like since gets wrong records.

given have referred below links have no idea how use them in query.

can split/explode field in mysql query?

equivalent of explode() work strings in mysql

how can fix this? how can explode column data , use in query ?

use , separate string , try query

select * promotion_table find_in_set("23",bungalow_ids) 

http://sqlfiddle.com/#!2/7bbcb/1


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -