Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Statement SQL Server 2008

Status
Not open for further replies.

Tdharris

Technical User
Oct 6, 2010
13
US
I'm working with a select statement that is supposed to identify claim id's that are not present in two separate tables. It runs successfully, but leaves off records that I know are not present in both tables. One table (CLAIMS) has only one instance of the ID the other (CLAIM_PROCS) can have multiple instances. I want to identify the records that are in claim_procs but not claims.

select * from claims
where claim_id not in
(select claim_id from claim_procs)
order by ap_upd

select count(*),ap_upd from claim_procs
where claim_id not in
(select claim_id from claims)
group by ap_upd
order by ap_upd

Any help identifying why my statement is not showing all records would be helpful.

TDH

TDH
Business App System Analyst
Information Technology
 

identify the records that are in claim_procs but not claims
Flip it around:
[tt]
select * from claim_procs
where claim_id not in
(select claim_id from claim)
order by ...
[/tt]

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top