尝试在两个复合表上进行内部联接,但语法有问题。这就是我所拥有的:
SELECT
count(*)
FROM
(
SELECT DISTINCT seller FROM Items, Users WHERE Items.seller = Users.userID t1
INNER JOIN
(
SELECT DISTINCT UserID FROM Bids, Users WHERE Bids.UserID = Users.userID
)
t2 ON t1.userID = t2.userID
)
我猜它与parantheses /缺乏as /或者其他什么有关。我想我在这里问的是如何给我的子查询别名,但不在FROM部分中使用。只有在User.userID之后使用t1并将整个表标识为t1?
才有效答案 0 :(得分:0)
我认为这就是你想要的?
SELECT count(*)
FROM Users
INNER JOIN Items ON Users.userID = Items.seller
INNER JOIN Bids ON Users.UserID = Bids.UserID
答案 1 :(得分:0)
您想要命名从查询
获得的输出表SELECT DISTINCT seller FROM Items, Users WHERE Items.seller = Users.userID
为t1 简单的方法是使用
`select * from (SELECT DISTINCT seller FROM Items, Users WHERE Items.seller = Users.userID)t1`