MySQL multiple columns in IN clause

前端 未结 5 524
既然无缘
既然无缘 2020-12-05 17:32

I have a database with four columns corresponding to the geographical coordinates x,y for the start and end position. The columns are:

  • x0
  • y0
5条回答
  •  情深已故
    2020-12-05 18:25

    You can concatenate the four values into a string and check them like that:

    SELECT * 
    FROM my_table 
    WHERE CONCAT_WS(',', x0, y0, x1, y1) IN ('4,3,5,6', ..., '9,3,2,1');
    

提交回复
热议问题