Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Output 1 string with OR operator

Author  Topic 

ingineu
Yak Posting Veteran

89 Posts

Posted - 2005-09-26 : 15:43:11
I have a table with a field that contains a filter string. I would like to combine the fields into 1 string with an 'OR 'logical operator.
eg.
FilterID 1 FilterString: (PROD.ProductID='10000')
FilterID 1 FilterString: (PROD.ProductID='10001')

Output as 1 line:
(PROD.ProductID='10000') OR (PROD.ProductID='10001')

SELECT FHDR.FilterID, FDET.QString 
FROM tblFilters FHDR
INNER JOIN (SELECT QString = ????, FilterID
FROM tblFilterDetails
GROUP BY FilterID) FDET
ON FDET.FilterID = FHDR.FilterID


ingineu
Yak Posting Veteran

89 Posts

Posted - 2005-09-26 : 19:24:40
Might be better to do this in Access with a recordset.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-26 : 19:47:06
Would this do?

CASE WHEN (PROD.ProductID='10000') OR (PROD.ProductID='10001') THEN 1 ELSE 0 END

Kristen
Go to Top of Page
   

- Advertisement -