簡體   English   中英

如何在向mysql查詢單個變量的地方執行X或Y?

[英]How to do a X or Y in where query mysql for a single variable?

我想做的偽查詢如下:

從mytable中選擇*,其中(myintvalue = 0或1)AND anothervalue =“ SomeValue”

上面的正確語法是什么?

使用IN子句

Select * from mytable where myvalue IN( 0,1) AND anothervalue = "SomeValue"
WHERE (myintvalue = 0 OR myintvalue = 1)
/* or */
WHERE myintvalue IN (0, 1)
SELECT * FROM mytable where (myintvalue = 0 OR myintvalue = 1) AND anothervalue= 'SomeValue';

要么

SELECT * FROM mytable where myintvalue in (0,1) AND anothervalue= 'SomeValue';

應該做的把戲

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM