Viewing 4 posts - 1 through 4 (of 4 total)
doesn't matter where I put the NOT IN, I get the same results.
The reason is that the join between Users and Orders will return multiple rows (especially with my test...
July 30, 2007 at 1:59 pm
its a very simple and common design:
Users
Id INT (Identity)
FirstName varchar(50)
LastName varchar (50)
etc.
Orders
Id INT (Identity)
UserId INT (FK from Users)
GrandTotal float
etc
Products
Id INT (Identity)
ProductName varchar(100)
etc
OrderItems
Id INT (Identity)
OrderId INT (FK from Orders)
ProductId INT (FK...
July 30, 2007 at 1:10 pm
SELECT dbo.Users.* FROM dbo.OrderItems INNER JOIN dbo.Orders ON dbo.OrderItems.OrderId = dbo.Orders.Id INNER JOIN dbo.Users ON dbo.Orders.UserId = dbo.Users.Id WHERE ProductId NOT IN (2001)
July 30, 2007 at 12:45 pm
To clarify, the dynamic SQL executes fine, my problem which is undoubtedly a logic error. What appears to be happening is this. Say I have User.Id = 1 and that...
July 30, 2007 at 12:37 pm
Viewing 4 posts - 1 through 4 (of 4 total)