此查询无效
function getStringLength(string) {
var counter = 0;
while (string.slice(counter)) {
counter++;
}
return counter;
}
var outputHello = getStringLength('hello');
console.log(outputHello); // 5
var outputEmpty = getStringLength('');
console.log(outputEmpty); // 0
它说yakk列是未知的,如果我删除它工作的where子句并显示列
答案 0 :(得分:2)
您必须在必须重复代码的情况下使用别名 (如果你转换为整数然后使用int进行比较)
SELECT CAST(o.total as SIGNED INTEGER) as yakk
FROM `order` o
WHERE CAST(o.total as SIGNED INTEGER) = 51 ORDER BY `o`.`order_id` DESC limit 0, 50
为select创建的别名不适用于where,因为在select子句
之前评估了where条件