Solved

SQL question

Posted on 2014-11-11
3
192 Views
Last Modified: 2014-11-11
I have SQL question I would like some help with.
0
Comment
Question by:mdoland
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:mdoland
ID: 40436034
Whoops, I missed the question...

I have to tables X and Y. See below.
X with columns A1 and A2.
Y with columns A1 and A3.

I want to have all elements from A1 in table X where there are no corresponding element A1 in Y.
Did that make sense?
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 40436038
select a1 from x
where a1 not in (select a1 from y)


or

select a1 from x
where not exists (select 1 from y where y.a1 = x.a1)


or

select a1 from x
minus
select a2 from y

Note, the minus version will implicitly return distinct values, that may or may not be what you want.
0
 

Author Comment

by:mdoland
ID: 40436079
Perfect!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question