IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Like operator
Go
New
Search
Notify
Tools
Reply
  
5-star Rating (1 Vote) Rate It!  Login/Join 
B_B
Silver Member
Posted
Hi,
I need to give a where clause using 'like' with 2 string values.
e.g. w
where column_name like 'abc' and 'xyz'

What would be the right syntax?
 
Posts: 47 | Registered: September 04, 2007Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
quote:
where column_name like 'abc' and 'xyz'


It totally depends on where you want the comparison

WHERE column_name LIKE 'abc%_' OR 'xyz%_'

I'm sure for such a well documented basic WebFocus process
learning to read would help you a great deal in your tasks.
 
Posts: 947 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Waz
Guru
Posted Hide Post
I agree with JG

As Tony A has mentioned many times the link at the top right of the page will get you to the documentation.

Although I would code
WHERE column_name LIKE '%abc%'
AND column_name LIKE '%xyz%'


Depending on what you mean by like and the values. Does it contain abc and xyz?


Waz...
Prod:WebFOCUS 7.1.6Upgrade:WebFOCUS 7.6.6OS:UnixOutputs:PDF, CSV, Excel, TXT, XML, HTML

 
Posts: 386 | Location: Sydney, Australia | Registered: October 31, 2006Reply With QuoteEdit or Delete MessageReport This Post
Virtuoso
Posted Hide Post
Tony is correct. It needs to be an OR not an AND. Otherwise you won't get any data.


Ginny
---------------------------------
Prod: WF 7.6.5 with 7.6.6 WFRS; AIX 5.2; WebSphere 6.1.0.15
Dev: WF 7.6.5 with 7.6.6 WFRS; AIX 5.3; WebSphere 6.1.0.15
Primarily self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable
 
Posts: 1537 | Location: BNSF: Fort Worth, TX | Registered: April 05, 2006Reply With QuoteEdit or Delete MessageReport This Post
JG
Master
Posted Hide Post
Ginny,

Tony is correct, IF you want the column to contain BOTH 'abc' AND 'xyz'

However if you require either/or then 'OR' is required, The % at the the begining or/end
depends on the postion of the search string.

quote:
It totally depends on where you want the comparison


Should perhaps have been Where and What you want the comparison to be.
 
Posts: 947 | Registered: February 24, 2005Reply With QuoteEdit or Delete MessageReport This Post
Waz
Guru
Posted Hide Post
The issue with getting no data comes down to how you code the WHERE clause

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY LIKE '%E%' AND '%G%'
END

Produces an error

TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY LIKE '%E%' OR '%G%'
END

Produces a list of ENGLAND, W GERMANY, FRANCE.

But if you use
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY LIKE '%E%' AND COUNTRY LIKE '%G%'
END

You get ENGLAND, W GERMANY


Waz...
Prod:WebFOCUS 7.1.6Upgrade:WebFOCUS 7.6.6OS:UnixOutputs:PDF, CSV, Excel, TXT, XML, HTML

 
Posts: 386 | Location: Sydney, Australia | Registered: October 31, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Like operator

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.