i have following data
customer_id | text | --------------------------- 001 | hi | 0 001 | | 1 002 | | 0 002 | not | 0 003 | copy | 0
in query, group_concat
values of text should results these
customer_id | text --------------------------- 001 | hi 002 | not 003 | copy
now want group_concat customer_ids if 1 of records had set 1, while can when customer_id 001 has both records value set 1 when there 1 has been set that
the situation lead data above being @ first customer 001 had "hi" time later "all" added want update customer data
there customer table has customer ids can not set update flag on customer id table has different data takes longer process , data above separate system
my query looks @ time being
select group_concat(text,' ') table = 1 group customer_id
what need in order customer_id 001 return "hi all" when 1 of 2 record's value 1 while @ same time not getting customer_id's 002 or 003
you can concat values, , total i
value. can filter field, knowing if @ least 1 of group has 1 appear
selec customer_id, text (select customer_id, group_concat(text,' ') text, sum(i) total table = 1 group customer_id) t total > 0