mysql - SQL How to get all rows with a joined table -


hi want data customers id in comma separated list table. current sql query looks this.

select t.trip, t.array, v.* trips t inner join customers v on v.id in (t.array)  t.date='2017-08-21' order t.trip 

the problem returns first row customers table, though there more one.

as per problem seems trying join customer ids stored comma separated list in t.array, in such case find_in_set need.

select t.trip, t.array, v.* trips t inner join customers v on find_in_set(v.id,t.array) > 0 t.date='2017-08-21' order t.trip 

p.s - not practice store them string.


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -