MySQL select join where AND where

后端 未结 3 1125
忘了有多久
忘了有多久 2020-12-14 21:10

I have two tables in my database:

Products

  • id (int, primary key)
  • name (varchar)

ProductTags

3条回答
  •  一向
    一向 (楼主)
    2020-12-14 22:06

    The MySQL WHERE fieldname IN (1,2,3) is essentially shorthand for WHERE fieldname = 1 OR fieldname = 2 OR fieldname = 3. So if you aren't getting the desired functionality with WHERE ... IN then try switching to ORs. If that still doesn't give you the results you want, then perhaps WHERE ... IN is not the function you need to use.

提交回复
热议问题