star equal operator in implicit join

I have code in my stored proc that is using an implicit join along with *= operator, which I am converting to explicit join and removing *= operator. Please suggest what is wrong in the following code conversion, as I am not getting the same results from both queries.

existing code:
SELECT c.policy,
       c.edition,
       Isnull(b.ulineID, a.ulineID)         AS ulineid,
       Isnull(b.dID, a.dID)                 AS did ,
       Sum(Isnull(a.prior_unit_count, 0))   AS prior_unit_count,
       Sum(Isnull(b.current_unit_count, 0)) AS current_unit_count
INTO   dbo.uc1
FROM   dbo.pmi1 a,
       dbo.cmi1 b,
       dbo.me1 c
WHERE  c.policy *= b.policy
       AND c.ulineID *= b.ulineID
       AND c.policy *= a.policy
       AND c.ulineID *= a.ulineID
GROUP  BY c.policy,
          c.edition,
          Isnull(b.ulineID, a.ulineID),
          Isnull(b.dID, a.dID)
ORDER  BY c.policy,
          c.edition,
          Isnull(b.ulineID, a.ulineID),
          Isnull(b.dID, a.dID)

Open in new window


converted code:
SELECT c.policy,
       c.edition,
       Isnull(b.uID, a.uID)                 AS uid,
       Isnull(b.dID, a.dID)                 AS did ,
       Sum(Isnull(a.prior_unit_count, 0))   AS prior_unit_count,
       Sum(Isnull(b.current_unit_count, 0)) AS current_unit_count
INTO   dbo.uc1
FROM   dbo.cmi1 b
       LEFT OUTER JOIN dbo.me1 c
                    ON c.policy = b.policy
                       AND c.uID = b.uID
       LEFT OUTER JOIN dbo.pmi1 a
                    ON c.policy = a.policy
                       AND c.uID = a.uID
GROUP  BY c.policy,
          c.edition,
          Isnull(b.uID, a.uID),
          Isnull(b.dID, a.dID)
ORDER  BY c.policy,
          c.edition,
          Isnull(b.uID, a.uID),
          Isnull(b.dID, a.dID)

Open in new window

patd1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
have you tried keeping the same order of tables:
FROM  dbo.me1 c
       LEFT OUTER JOIN  dbo.cmi1 b
                    ON c.policy = b.policy
                       AND c.uID = b.uID
       LEFT OUTER JOIN dbo.pmi1 a
                    ON c.policy = a.policy
                       AND c.uID = a.uID

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott PletcherSenior DBACommented:
b.ulineID and a.ulineID are not the same columns as b.uID and a.uID.

Otherwise I don't see any ambiguities that could cause problems, as in some *= situations.
0
patd1Author Commented:
Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.