Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Outer Join

Author  Topic 

kidaduo
Starting Member

45 Posts

Posted - 2008-06-20 : 09:54:52
Help!
I have a query that runs fine with 2 outer joins, but I am using "*=" syntax and this won't work for SQL 2005.

I am replacing with 'LEFT OUTER JOIN'... I can get it to work okay for first join, but not when I add the second

Any idea


Josephine

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-20 : 10:13:33
Nothing can be advised based on currently provided information. We need to get an idea of how your data is and what you're trying to achieve before giving a solution. So can you please post the involved tables' structures along with some sample data and output you're trying to achieve?
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-06-20 : 10:17:14
This is my issues:

why this qry is not working in 2005 sql?

SELECT i.namelong "AMC_FULL_NAME",
s.acqdate "FORECLOSURE_ACQ_DT",
m.ns_acqdate "DATE_OF_RELEASE",
m.ns_conphon "SERVICER_PHONE",
0 "TOTAL_AMT_DELQ"
from country i,
city m,
state s
where m.deptno *= i.code1
and i.cd_type = 'dept'
and m.uniq_id *= s.muniq_id


quote:
Originally posted by visakh16

Nothing can be advised based on currently provided information. We need to get an idea of how your data is and what you're trying to achieve before giving a solution. So can you please post the involved tables' structures along with some sample data and output you're trying to achieve?



Josephine
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-06-20 : 10:19:38
Try this

SELECT i.namelong AS AMC_FULL_NAME,
s.acqdate AS FORECLOSURE_ACQ_DT,
m.ns_acqdate AS DATE_OF_RELEASE,
m.ns_conphon AS SERVICER_PHONE,
0 AS TOTAL_AMT_DELQ
from city m
left join
country i
on
m.deptno = i.code1
left join
state s
on
m.uniq_id = s.muniq_id
where
i.cd_type = 'dept'
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-06-20 : 10:38:51
Excellent!

quote:
Originally posted by jimf

Try this

SELECT i.namelong AS AMC_FULL_NAME,
s.acqdate AS FORECLOSURE_ACQ_DT,
m.ns_acqdate AS DATE_OF_RELEASE,
m.ns_conphon AS SERVICER_PHONE,
0 AS TOTAL_AMT_DELQ
from city m
left join
country i
on
m.deptno = i.code1
left join
state s
on
m.uniq_id = s.muniq_id
where
i.cd_type = 'dept'



Josephine
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-20 : 18:19:20
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105238

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -