Forum Replies Created

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

  • RE: How to write CROSS JOIN using subquery?

    @ggraber:

    FULL OUTER JOIN =

    LEFT OUTER JOIN

    UNION

    RIGHT OUTER JOIN

    Am I get the point?

    @matt-2: How do you mean? As I can't get the cartesian product from combinations that...

  • RE: How to write CROSS JOIN using subquery?

    I didn't look details, but now I see that your code is (almost) the same - just remove '@' before Employees and Orders.. that's all...

    BTW. Now I'm breaking my head...

  • RE: How to write CROSS JOIN using subquery?

    Here's how you would post the DDL and sample data.

    DECLARE @Orders TABLE

    (

    OrderID BIGINT

    ,CustomerID NCHAR(5)

    ,EmployeeID BIGINT

    ,OrderDate DATETIME

    )

    DECLARE @Employees TABLE

    (

    EmployeeID BIGINT

    ,LastName NVARCHAR(20)

    ,FirstName NVARCHAR(10)

    ,Title NVARCHAR(30)

    )

    INSERT INTO @Orders

    SELECT 10248, ...

  • RE: How to write CROSS JOIN using subquery?

    Thank you very but very much guys, specially you Steve!

    @ggraber: code you have posted doesn't work, but anyway previous Steve's code gives me some ideas and tricks so here it...

  • RE: How to write CROSS JOIN using subquery?

    Basic requirement is to use subqueries, but loops are alowed too...

    I can post DDL and sample data but isn't it easier way just to post Northwind MDF and LDF files...

  • RE: How to write CROSS JOIN using subquery?

    What is she trying to teach? Have no idea, just like you guys... Only reason I can see is brain weighing - if you like math, you'll know what I'm...

  • RE: How to write CROSS JOIN using subquery?

    comma is just an abbreviation for CROSS JOIN... I think that only solution is to use Steve's code with WHILE loops... but I can't figure it out where is the...

  • RE: How to write CROSS JOIN using subquery?

    smunson (7/2/2008)


    Come to think of it, I realized this wasn't all that hard if a table variable is ok...

    Try this on for size - I have no NORTHWIND available, so...

  • RE: How to write CROSS JOIN using subquery?

    Steve, you're right, but this is not a key thing - it can be Customes instead of Employees if you like... the problem is the same... and is not solved...

  • RE: How to write CROSS JOIN using subquery?

    Michael Earl (7/1/2008)


    This is technically not a CROSS JOIN:

    [font="Courier New"]USE Northwind

    SELECT Title, Customerid

    FROM Employees

    FULL OUTER JOIN Orders ON 1=1[/font]

    The query optimizer found it a pretty dumb thing to do as...

  • RE: How to write CROSS JOIN using subquery?

    @steveb-2: well yes 🙂 As I know, CROSS JOIN is Cartesian product 🙂

    The question on exam is pretty simple:

    USE Northwind

    SELECT Title, Customerid

    FROM Employees

    CROSS JOIN Orders

    Make the same...

  • RE: How to write CROSS JOIN using subquery?

    Michael Earl (7/1/2008)


    Is this a homework question? This seems like a rediculous restriction.

    I would suggest you look at the APPLY operator.

    It's not homework, but it is an...

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