Re: Query training -- Complex queries

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: DW (None)
Date: 02/26/04


Date: Wed, 25 Feb 2004 16:12:42 -0800

Erland Sommarskog <sommar@algonet.se> wrote in
news:Xns949B671D1EA5Yazorman@127.0.0.1:

> As Adam pointed out, the problem with the second query is that the
> derived table is not correlated with the updated table, so you get a
> magnificent cross join, and I'm not surprise that it did not complete
> in 20 minutes.

Thanks to both of you for the answers. I will check out those books on
Amazon.

Regarding this join:

Update PositionsEOM
Set MktVal = Derived.MktVal From
(Select PM.Price * PositionsEOM.Quantity_ASD As MktVal
>From PositionsEOM Inner Join [Price Master] As PM On
    PositionsEOM.Fund_ID = PM.Fund_ID And
    PositionsEOM.Position_Date = PM.Price_Date) As Derived

Why is this a cross join? It has the phrase "Inner Join" in it (with
two conditions, hence the AND). I'm confused...

Thanks.

David Walker