search

Home  >  Q&A  >  body text

php - Problem with Sql conditional statement

A sql statement has an employee id field after group by and is put together through the group concat function. Now the business requires finding the result that the employee id is a, then the employee field must be filtered whether it only has a or contains a. Come on, how do you write this?

阿神阿神2807 days ago561

reply all(3)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-19 10:10:19

    It is recommended that you briefly list the attributes of the table, otherwise the description will not be clear.
    group concat is just grouping, what really plays a filtering role is the where condition

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:10:19

    select * from table where id like '%a%' 

    reply
    0
  • 迷茫

    迷茫2017-05-19 10:10:19

    Use subquery, wrap it one layer and add where condition

    reply
    0
  • Cancelreply