我有一個sql表,名爲TagQuestion
,它有id
,tagId
,questionId
等字段。對同一列的MySQL AND運算符
下面是出現在表中的數據:
+---------------------+
|id |tagId |QuestionId|
+---------------------+
|2 |1 |2 |
|4 |1 |3 |
|6 |2 |3 |
+---------------------+
我想從表questionIds爲其tagId=1
以及tagId=2
我試圖查詢作爲 -
select * from TagQuestion where (tagId=1 AND tagId=2)
但它沒有返回任何東西。
能否請您幫我出這個
什麼是您的確切預期結果?只是「3」? –
該查詢返回任何內容,因爲它的邏輯錯誤。你能說出一個同時滿足number = 1和number = 2的數字嗎? – Mak