[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Join using a 'like'

Posted on 2012-03-30
2
Medium Priority
?
276 Views
Last Modified: 2012-03-30
I need to find the best way to join another table using a like in the join.

What I have is a query that has a inner join, and left outer join and it is working.
The first part of the query (with the inner join) joins 2 tables together to look for and calculate device events and their duration. The outer join pulls in any event messages if any.

Now what I need to do is join yet another table if the device name appears in one of two fields in another table. So if the device name from the first query appears somewhere in the summary or description fields in the last joined table I need to pull in additional information.

So what I am looking for a way to do this is like

...
outer left join HelpDesk HPD
.. if QueryA.DeviceName appears somewhere in the HPD Sumamry or Description fields


Possible?
0
Comment
Question by:edrz01
[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 Comments
 
LVL 8

Accepted Solution

by:
gpizzuto earned 2000 total points
ID: 37786645
outer left join HelpDesk HPD
ON (NPD.Summary+NPD.Description like '%'+QueryA.DeviceName+'%')

Probably you need to use ISNULL(,) both for Summary and for Description
0
 

Author Comment

by:edrz01
ID: 37786782
gpizzuto, Thanks for the idea. I had to also include my date ranges as it was trying to look at all records in the other joined table. Now that I did that the query works!

Thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 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