Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)

  • RE: help with dynamic SQL

    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...

  • RE: help with dynamic SQL

    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...

  • RE: help with dynamic SQL

    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)

  • RE: help with dynamic SQL

    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...

Viewing 4 posts - 1 through 4 (of 4 total)