Php and MySQL GROUP_CONCAT with separator comma and search where concat by comma

前端 未结 1 1983
粉色の甜心
粉色の甜心 2021-01-06 15:59

Is it that possible to select in Group_concat with separator comma and search where concat by comma Here My sample of mysql :

products_attributes_id  |produc         


        
相关标签:
1条回答
  • 2021-01-06 16:22

    Try this:

    SELECT 
        products_id , 
        GROUP_CONCAT(options_values_id SEPARATOR ',') as ops 
    FROM 
        products_attributes 
    GROUP by 
        products_id
    HAVING
        FIND_IN_SET('1',ops)
        OR FIND_IN_SET('3',ops)
    
    0 讨论(0)
提交回复
热议问题