Search for text in specific rows

时间:2017-03-22 18:48:32

标签: mysql sql

I have a table with category and title columns.

category     title
---------    ------
game         abcd
tech         567
tech         1234
game         efg
tech         abcd

I need all the rows with game as category, then select all the "game" rows that have '1234' or 'efg' or 'abcd' as title. Is there a way to do this with one single query?If not, what's the best solution?

1 个答案:

答案 0 :(得分:1)

This is very basic SQL. I'd suggest you to go through some basic SQL tutorials first.

select *
from your_table
where category = 'game'
    and title in ('1234', 'efg', 'abcd')
相关问题