哪个字段(如果有)从未用于游戏或练习? 这就是我要回答的问题。
我已经尝试过多次以使其正常工作。当我删除代码的“不存在”部分时,它将返回5个结果。这是正确的,因为有五个场地,其中“类型” =“场地”。问题是这5个字段中只有两个没有在练习或游戏中使用。
Select Venue.Name, Venue.VenueID
from Venue
where Venue.Type = 'Field'
and not exists (select VenueID from Games)
and not exists (select VenueID from Practices)
结果基于输入到数据库中的数据应返回两个结果。
答案 0 :(得分:1)
我是MySQL的新手。看起来应该适合您。
我使用NOT IN
关键字代替了NOT EXISTS
Select Venue.Name, Venue.VenueID
from Venue
where Venue.Type = 'Field'
and Venue.VenueID NOT IN (select VenueID from Games)
and Venue.VenueID NOT IN (select VenueID from Practices)
答案 1 :(得分:1)
您必须在子查询中设置一个条件:
Select
v.Name, v.VenueID
from Venue v
where
v.Type = 'Field'
and
not exists (select VenueID from Games where VenueID = v.VenueID)
and
not exists (select VenueID from Practices where VenueID = v.VenueID)
您想要其他两个表中不存在的ID。
答案 2 :(得分:0)
我强烈建议您不要使用Mono<Baz> getBazRx(Foo foo) {
return Mono.fromSupplier(() -> {
try {
return getBaz(foo);
} catch (IOException e) {
throw Exceptions.propagate(e); // or return null to ignore and complete empty
}
})
.subscribeOn(Schedulers.elastic()); // run on a scheduler suitable for blocking work
}
。如果子查询返回的值 any 为--JS--
var socket = io.connect("http://94.248.229.179:3000");
var button = $('.button');
var items = $('.items');
var coin_width = 75;
var numbers = {
0: 525,
1: 0,
2: 150,
3: 300,
4: 450,
5: 675,
6: 825,
7: 975,
8: 1050,
9: 900,
10: 750,
11: 600,
12: 375,
13: 225,
14: 75
};
socket.on("roulettenumber", function(data){
var number = data.roulettenumber;
var cycles = Math.floor(getRandomArbitrary(2, 8));
var dev = getRandomArbitrary(0, 72);
var scroll_amount = ((825 + numbers[number]) + dev) + (1125 * cycles);
items.removeClass("spin_animation");
items.css({"background-position-x": "-262.5px"});
setTimeout(function(){
items.addClass("spin_animation");
items.css({"background-position": "-" + scroll_amount + "px"});
console.log("W: " + number + " SA: " + scroll_amount + " D: " + dev + " C: " + cycles);
}, 10);
});
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
--CSS--
.wrapper {
overflow: hidden;
width: 600px;
}
.items {
background-image: url("../img/roulette.png");
position: relative;
width: 1125px;
height: 75px;
}
.items:before {
content: "";
position: absolute;
background: #ffd02d;
height: 100%;
width: 3px;
margin: 0 auto;
left: 0;
right: 0;
}
.spin_animation {
transition-timing-function: cubic-bezier(0.34, 0.87, 0.52, 1); /* custom */
transition-duration: 6.79891s;
}
--HTML--
<div class="wrapper">
<button class="button">Spin</button>
<div class="items"></div>
</div>
,not in
将完全不返回任何行。这是违反直觉的。
在使用相关子查询时,我也强烈建议限定 all 列名。所以我建议:
NOT IN