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

BI Monkey BI Monkey is the ‘nom de plume’ of James Beresford, a Certified Microsoft BI Professional and MBA living and consulting in Sydney

Reply
 
LinkBack Thread Tools Display Modes
Old 28th January 2010, 07:25 PM   #1 (permalink)
Senior Member
 
Join Date: Jun 2009
Posts: 62
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   Reply With Quote
Reply

Bookmarks

Thread Tools
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 Latest News 0 25th November 2009 08:17 AM
GlobeOp Financial Services publishes Interim Management Statement Latest News Headlines Latest News 0 27th October 2009 11:02 PM


All times are GMT +11. The time now is 08:02 PM.

© The Business Intelligence Group

Search Engine Optimization by vBSEO 3.3.0