SQL filtering by multiple columns

前端 未结 3 1322
旧时难觅i
旧时难觅i 2021-01-13 07:24

I have a MySql table, which I want to query for rows in which pairs of columns are in a specific set. For example, say my table looks like this:

<         


        
3条回答
  •  甜味超标
    2021-01-13 07:48

    A rough but practical way is to use string concatenation:

    SELECT *
    FROM MyTable
    WHERE CONCAT(f1, '_', f2) IN ('a_30', 'b_20')
    

提交回复
热议问题