我无法弄清楚如何更改左连接子句中的条件必须为真的代码。
<?php
$wurm_run = mysql_query("SELECT s.killperweek FROM statistik as s WHERE (LEFT JOIN wurm_stats as w ON tag = '$tag' and month = '$monat' and setflag = 0) ");
while ($wurm = mysql_fetch_array($wurm_run))
{
$newkill = $wurm[0] +1;
echo $newkill;
mysql_query("update statistik set killperweek ='$newkill' ") or die(mysql_error());
mysql_query("update wurm_stats set setflag= 1 WHERE tag = '$tag' and month = '$monat' ") or die(mysql_error());
}
?>
&#13;
EDIT&#39;我知道查询&#34;工作&#34;如果我使用WHERE
更改ON
,但那不是我想要的结果
答案 0 :(得分:0)
SELECT s.killperweek FROM statistik as s LEFT JOIN wurm_stats as w ON YOUR_ALIAS_can_be_s_or_w.tag = '$tag' WHERE YOUR_ALIAS_can_be_s_or_w.month = '$monat' and YOUR_ALIAS_can_be_s_or_w.setflag = 0
我希望$ tag包含你的表别名和外键。