MySQL multiple columns in IN clause

前端 未结 5 547
既然无缘
既然无缘 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:27

    The way you are doing is giving correct results in the mysql version on my machine. I am using v5.5.55. Maybe you are using an older one. Please check that.

    If you still want to solve this problem in your own version or the above mentioned solution doesn't work then only read the next solution.

    I am still not clear about data types and range of all your columns here. So I am assuming that data type is integer and range is between 0 to 9. If this is the case you can easily do this as given below.

    select * from s1 where x0+10*x1+100*y1+1000*y2 in (4356,..., 9321);
    

提交回复
热议问题