带左连接的 Combo 中的 where 子句
A where Clause in Combo with left join
我不知道如何更改左连接子句中的条件需要为真的代码。
<?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());
}
?>
EDIT' 我知道查询 "works" 如果我将 WHERE
更改为 ON
但这不是我想要的结果
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 包含您的 table 别名和外键。
我不知道如何更改左连接子句中的条件需要为真的代码。
<?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());
}
?>
EDIT' 我知道查询 "works" 如果我将 WHERE
更改为 ON
但这不是我想要的结果
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 包含您的 table 别名和外键。