我期望以下产生超过3行,因为在每个a [。种类]中都有min(a。[Sepal.Width])的关系, 但是只返回3行:
sqldf(' select a.[Species], min( a.[Petal.Width]) from iris a group by a.[Species] ')
Species min( a.[Petal.Width])
1 setosa 0.1
2 versicolor 1.0
3 virginica 1.4
1:这是SQLite的正常行为吗?
2:如何设计选择字符串以返回绑定? (最好尽可能接近原始搜索字符串)
编辑:我现在看到我的困惑源于习惯使用SAS proc sql,它将返回所有匹配的行。我现在已经知道这确实是SAS proc SQL的特有之处,而不是其他SQL版本的预期。与我相同的SAS引起混淆的人将从这个阐明SAS行为的答案中受益:https://stackoverflow.com/a/25539916/1831980
答案 0 :(得分:2)
我就是这样做的:
sqldf::sqldf('SELECT b.[Species], b.[Petal.Width] FROM iris b JOIN
(SELECT [Species], MIN( [Petal.Width]) AS [Petal.Width]
FROM iris GROUP BY [Species]) a
USING ([Species],[Petal.Width])')
答案 1 :(得分:1)
我怀疑这就是你想要的:
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var modal = document.getElementById('myModal');
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "block";
}
$(".close").click(function() {
modal.style.display = "none";
stopVideo();
});
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
stopVideo();
}
}
var player;
$( document ).ready(function() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'JY1ddEDcVV0',
rel: '0',
controls: '0',
showinfo: '0'
});
});
function stopVideo() {
player.stopVideo();
}