是否可以使用连接子查询中外部选择的列值?
SELECT table1.id, table2.cnt FROM table1 LEFT JOIN (SELECT COUNT(*) as `cnt` FROM table2 where table2.lt > table1.lt and table2.rt < table1.rt) as table2 ON 1;
Run Code Online (Sandbox Code Playgroud)
这导致'where子句'中的"未知列'table1.lt'".
这是db转储.
CREATE TABLE IF NOT EXISTS `table1` ( `id` int(1) NOT NULL, `lt` int(1) NOT NULL, `rt` int(4) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `table2` ( `id` int(1) NOT NULL, `lt` int(1) NOT NULL, `rt` int(4) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `table1` (`id`, `lt`, `rt`) VALUES (1, …Run Code Online (Sandbox Code Playgroud) 当我针对我正在构建的基于Angular的应用程序运行jSLint时,我收到"意外'$ scope'"错误.
下面是导致错误的代码的简化版本.您可以将代码输入jslint.com网站以重现该问题.
我不明白为什么第一个函数声明(downloadFile)不会导致错误,但第二个函数声明(buildFile).
/*jslint browser: true*/
/*global angular */
angular.module('testApp')
.controller('FileCtrl', ["$scope", function ($scope) {
"use strict";
$scope.downloadFile = function () {
window.location = '/path/to/file';
}
$scope.buildFile = function () {
}
}]);
Run Code Online (Sandbox Code Playgroud)