我试图在SQLFiddle上运行一个复杂的连接查询,但一直遇到错误。想要在select语句中打印所有主要属性。过去几天卡住了。伸出援助之手将非常感激。
//location of ship
var location1 = 3;
var location2 = 4;
var location3 = 5;
//number of guesses
var guess;
var guesses = 0;
var hits = 0;
//is the ship sunk?
var isSunk = false;
while (isSunk == false) {
guess = prompt("Ready, aim, FIRE! Enter a number 0 - 9 to hit the ship!");
if (guess > 6 || guess < 0) {
alert("Please enter a valid number fool!");
} else {
guesses = guesses + 1;
}
if (guess == location1 || guess == location2 || guess == location3) {
hits = hits + 1;
if (hits == 3) {
alert("You sank my B ship hombre");
}
}
}
}
var stats = "You took " + guesses + " guesses to sink the battleship. Your accuracy is " + (3/guesses);
答案 0 :(得分:1)
您试图在实际SalesInvoice
之前引用join
中的join
表格,因此它并不存在。您只需要更改联接的顺序:
SELECT Customer.CustomerID, FirstName, LastName, StreetAddress,
Apartment, City, State,
ZipCode, HomePhone, MobilePhone,
OtherPhone, Donut.DonutID, Name, Description,
UnitPrice, DonutOrder.DonutOrderID, DonutOrder.DonutID,
Quantity, SalesInvoice.DonutOrderID,
SalesInvoice.CustomerID
FROM donut
JOIN DonutOrder ON Donut.DonutID = DonutOrder.DonutID
JOIN SalesInvoice ON DonutOrder.DonutID = SalesInvoice.DonutOrderID
JOIN Customer ON SalesInvoice.CustomerID = Customer.CustomerID
答案 1 :(得分:0)
简化为运行查询,如下所示
SELECT c.*, d.*, dor.*, si.* FROM donut d left outer JOIN DonutOrder dor ON dor.DonutID = d.DonutID left outer JOIN SalesInvoice si ON si.DonutOrderID = si.DonutOrderID left outer JOIN Customer c on c.CustomerID = si.CustomerID