0
我有一個查詢,我想顯示結果如果我的兩個字段是相等的零或空。使用或在where子句爲零或爲空
foreach ($query=$db->query("SELECT *,
t1.CMD_ID, t1.CMD_CLT_RS, t1.CMD_CLT_ID,
t2.CLT_ID, t2.CLT_CODE
FROM sous_commandes
LEFT OUTER JOIN commandes AS t1 ON (t1.CMD_ID=sous_commandes.SCMD_CMD_ID)
LEFT OUTER JOIN client AS t2 ON (t2.CLT_ID=t1.CMD_CLT_ID)
WHERE SCMD_FRN_ID = '$frn_id' AND SCMD_FACT_TOTAL_HT = '0' || IS NULL AND SCMD_FACT_TOTAL_TTC = '0' || IS NULL
ORDER BY STR_TO_DATE(SCMD_DATE, '%d/%m/%Y') DESC") as $donnees):
我試圖用|| IS NULL,但它不起作用。沒有顯示結果。 謝謝。
變化''||爲'或'' – krishna
'||爲[** **有效(HTTPS:/ (AND)(SCMD_FACT_TOTAL_HT ='0'或SCMD_FACT_TOTAL_HT IS NULL)AND(SCMD_FACT_TOTAL_TTC ='0'或SCMD_FACT_TOTAL_TTC IS NULL)在MySQL –
中嘗試「 「 –