Is possible have different conditions for each row in a query?

前端 未结 4 637
甜味超标
甜味超标 2021-01-25 19:26

How I can select a set of rows where each row match a different condition?

Example:

Supposing I have a table with a column called name, I want the

4条回答
  •  时光说笑
    2021-01-25 19:58

    you can, but probably not in a way you would want:

    if your table has a numeric id field, that is incremented with each row, you can self join that table 3 times (lets say as "a", "b" and "c") and use the join condition a.id + 1 = b.id and b.id + 1 = c.id and put you filter in a where clause like: a.name = 'A' AND b.name = 'B' AND c.name = 'C'

    but don't expect performance ...

提交回复
热议问题