Find records impacted by more than 1 person?

Posted on 2011-09-14
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:


I want to know what all ASSET_ID's have comments
from both '%JIM'%' and '%NANCY%'. How to do this easily?
Question by:JustinW
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
LVL 77

Accepted Solution

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%'
select asset_id from table where comment is not null and worker_name like '%NANCY%'

Author Comment

ID: 36537136
Oracle in this case.
Worked perfect, thanks a tonne!
LVL 74

Expert Comment

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%')
LVL 77

Expert Comment

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

Glad to help.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

691 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