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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple or query

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
I have two tables tblA and tblB

tblA
==========
fdA | fdB | fdC

tblB
==============
fdA | fdD

I need to check if any fields in tblA contain a certain string but also concatenate a 2 fields together in two different tables ie

SELECT fdB + '' + fdD
FROM tblA a, tblB b
WHERE a.fdA = b.fdA
OR fdA like '%MYSTRING%'
OR fdB like '%MYSTRING%'
OR fdC like '%MYSTRING%'


The join in this query brings back a result for every row in tblB too however. What is the best way to achieve what I am trying to do?

 
Something like this (ANSI syntax)?
SELECT fdB || '' || fdD
FROM tblA a INNER JOIN tblB b ON a.fdA = b.fdA
WHERE fda || fdB || fdC LIKE '%MYSTRING%'


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top