Solved

Find records impacted by more than 1 person?

Posted on 2011-09-14
4
317 Views
Last Modified: 2012-05-12
Sorry if the title is vague. I couldn't think of a better way to describe
what I'm trying to do.

I have a table that has the following five fields:

COMMENT_SYS_ID,
ASSET_ID,
WORKER_NAME,
COMMENT_DATE,
COMMENT

I want to know what all ASSET_ID's have comments
from both '%JIM'%' and '%NANCY%'. How to do this easily?
0
Comment
Question by:JustinW
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 36537096
What database?  This was posted in three different zones.

In Oracle and probably some of the others:

select asset_id from table where comment is not null and worker_name like '%JIM%'
intersect
select asset_id from table where comment is not null and worker_name like '%NANCY%'
0
 
LVL 1

Author Comment

by:JustinW
ID: 36537136
Oracle in this case.
Worked perfect, thanks a tonne!
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 36537147
may not be the most efficient but should be portable to just about any SQL based platform


select asset_id from yourtable
where worker_name like '%JIM%'
and asset_id in (select asset_id from yourtable where worker_name like '%NANCY%')
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36537149
>>Worked perfect, thanks a tonne!

Glad to help.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now