use Northwind
go select dbo.Customers.CustomerID
from dbo.Customers ,dbo.Orders
where dbo.Orders.CustomerID=dbo.Customers.CustomerID
go
go select dbo.Customers.CustomerID
from dbo.Customers ,dbo.Orders
where dbo.Orders.CustomerID=dbo.Customers.CustomerID
go
from Customers,Orders
where Orders.CustomerID=Customers.CustomerID
go select dbo.Customers.CustomerID
from dbo.Customers inner join dbo.Orders
on dbo.Orders.CustomerID=dbo.Customers.CustomerID
go
呵呵,你的 dbo.Customers表呢?
可以用连接
select dbo.Customers.CustomerID
from dbo.Customers inner join dbo.Orders
on dbo.Orders.CustomerID=dbo.Customers.CustomerID 也可以
select Customers.CustomerID
from Customers,Orders
where Orders.CustomerID=Customers.CustomerID
go select dbo.Customers.CustomerID
from dbo.Customers
where dbo.Orders.CustomerID=dbo.Customers.CustomerID
go dbo.Orders没有出现在from后面
改为select dbo.Customers.CustomerID
from dbo.Customers ,dbo.Orders
where dbo.Orders.CustomerID=dbo.Customers.CustomerID