答案 0 :(得分:4)
使用<body>
<h2>Traversering og elementskapelse</h2>
<div>
<label>Antall div'er å generere:
<input id="nmbrSquare" type="number" value="5">
</label>
<input id="addSquareBtn" type="button" value="Generér">
</div>
<div id="boxes"></div>
<script>
function generateDivs(amount) {
container.empty();
for (var i = 0; i < amount; i++) {
var div = $('<div>');
div.addClass('box');
container.append(div);
}
}
var container = $('#boxes');
$("#addSquareBtn").click(function() {
var nmbrSquare = $("#nmbrSquare").val();
generateDivs(nmbrSquare)
});
generateDivs(1);
$(function() {
$(document).on('click','#boxes',function(){
$(event.target).css('background-color', 'plum');
$(event.target).prev().css('background-color', 'plum');
$(event.target).next().css('background-color', 'plum');
});
});
</script>
</body>
:
not exists
如果需要更多列比较,可以扩展逻辑:
select l.*
from `left` l
where not exists (select 1 from `right` r where r.id = l.id);
答案 1 :(得分:1)
您正在寻找左排除连接
SELECT A.*
FROM Table_A A
LEFT JOIN Table_B B
ON A.Key = B.Key
WHERE B.Key IS NULL
有关SQL连接的文章,请参阅此文章 https://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins