I am learning vb.net and ms sql (2000 evaluation version); I can't get my joins to work in Tsql:
select m.lname,m.fname,m.idno,m.payorno,p.payorno.p.payor name
from dbtemp..d_mbrdata m join dbtemp..d_payors p
on (m.payorno = p.payorno)
inner join query returns no records at all. left outerjoin returns the mbrdata fields, but the payors fields show as null. payorno in both tables is type integer and both tables definitely have matching records. I created index for both tables on payorno.
Does anyone have an idea what i am doing wrong here? Thanks.There is nothing wrong with query. If left join returns some data - problem is in second table (matching records).
Just run this query (without join):
select *
from dbtemp..d_mbrdata
where payorno in (select distinct payorno from dbtemp..d_payors)|||Yeah, from the way u'r describing u'r results, it seems there is no m.payorno that is equal to p.payorno.
Maybe u can try debuggin further by inserting a new record into both this tables with a "confirm" identical payorno and do your select join statement again.
It should return 1 joined record.|||Try running this and see what key values are returned:
select m.payorno, p.payorno
from dbtemp..d_mbrdata m
full outer join dbtemp..d_payors p on (m.payorno = p.payorno)
where mpayrono is null or p.payorno is null
blindman
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment