CLOSED。我在与布尔无关的其他地方犯了一个错误。
我在这个SQL中做错了什么:
WHERE (country = 'HK') OR (country = 'TW') OR (country = 'AX')
在输出中缺少AX的结果。
这个布尔表达式我做错了什么?
注1。 '在AX的尽头是我的错字。我在上面纠正了
这里的完整代码
$myresult = mysqli_query($GLOBALS['DBlink'],
"SELECT $getcolumn
FROM levermann
WHERE
( $sqlwhere2 ) AND
levermann.`WEEK` =
(SELECT `WEEK`, COUNT(*) AS cc
FROM levermann
WHERE ( $sqlwhere2 )
GROUP BY `WEEK`
HAVING cc > 4
ORDER BY `WEEK` DESC
LIMIT 1 )
AND $lswitch AND $marketcap
ORDER BY LScore2 DESC, MarketCAPUSD DESC, Stock_Short ASC
LIMIT 10;");
if ($region == 'ASIA') {
$sqlwhere2 = "
( country = 'HK' ) OR
( country = 'TW' ) OR
( country = 'AX' ) OR
( country = 'KS' ) OR
( country = 'SS' )";
$region='Asia';
}
if ($region == 'Global') {
$sqlwhere2 = " country like '%'";
$region='Global';
}
if ($region == 'US') {
$sqlwhere2 = " country = 'US'";
$region='US';
}
答案 0 :(得分:4)
封闭'AX‘
另外,为什么不使用in()
呢?
WHERE country in ('HK','TW','AX')
答案 1 :(得分:0)
整个陈述应在括号中
编辑:最后也有错误的引用
WHERE (country = 'HK' OR country = 'TW' OR country = 'AX')
答案 2 :(得分:0)
你的情况有误
(country = 'AX‘)
你没有使用结尾''正确。请正确并检查