Go Back   CORTEX Forums > Local Happenings > CORTEX Blogs > BI Monkey
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Multiple LIKE clauses in a single WHERE statement

This is a discussion on Multiple LIKE clauses in a single WHERE statement within the BI Monkey forums, part of the CORTEX Blogs category; I recently came up against a scenario where, in amongst a number of other filters, I had to deal with a couple of wildcard criteria. As there is no option ...


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 28th January 2010, 07:25 PM   #1
Guru
 
Join Date: Jun 2009
Posts: 122
James Beresford is on a distinguished road
Thumbs up Multiple LIKE clauses in a single WHERE statement

I recently came up against a scenario where, in amongst a number of other filters, I had to deal with a couple of wildcard criteria. As there is no option to have multiple LIKE clauses in native SQL, such as WHERE Field LIKE IN (’%Option1%’,'%Option2%’), I feared I was stuck with having to duplicate my WHERE clause in its entirety for each LIKE operation – until I found this cunning bit of code (from the thread here):
/* Apply Multiple LIKE clauses in a single WHERE clause */
SELECT**
*
FROM*[AdventureWorks].[Person].[Contact]
*
WHERE*CASE
**WHEN FirstName LIKE‘Gusta%’ THEN 1
**WHEN FirstName LIKE ‘Cath%’ THEN 1
**END = 1

An*elegant solution!



Get More from the original blog...
James Beresford is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiTweet this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Single Source Of Truth admin S - U 0 26th January 2010 05:26 PM
Bottom up and top down approaches to estimating costs for a single BI report Latest News Headlines Forrester 0 24th January 2010 10:56 AM
Be wary of ?the single metric? Infohrm Infohrm 0 8th December 2009 04:32 PM
Industry fails to find a single mortgage trust structure Latest News Headlines 2009 Q4 News Headlines 0 25th November 2009 08:17 AM
GlobeOp Financial Services publishes Interim Management Statement Latest News Headlines 2009 Q4 News Headlines 0 27th October 2009 11:02 PM


All times are GMT +11. The time now is 09:06 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO