‎2008 Mar 11 4:24 PM
Is it possible to use LIKE keyword in a SELECT statement more than once? If not, is there any alternate way of doing this? I am not getting anything returned when I use it twice on the same field.
I have a table CDPOS with field TABKEY which is 70 CHAR long.
Value of field TABKEY in table CDPOS = '00003001001PR00'
LINEITEM = '000030%'
CONDITION = 'PR00%'
I used the following select statement to retrieve the above CDPOS value..
select objectid changenr from cdpos into table tmp_cdpos
where tabkey like LINEITEM and tabkey like CONDITION.
If I use just 'lineitem' with the LIKE, it works but adding 'tabkey' results in no hits.
‎2008 Mar 11 4:38 PM
Try:
SELECT * FROM cdpos
WHERE tabkey LIKE '000030_____PR00%'. <== UnderscoresRob
‎2008 Mar 11 4:33 PM
Use OR instead of AND in the select statement then it works.
select objectid changenr from cdpos into table tmp_cdpos
where tabkey like LINEITEM
OR tabkey like CONDITION.
Thanks
Srinivas
‎2008 Mar 11 4:34 PM
change CONDITION = 'PR00%'
to CONDITION = '%PR00'
The % represents the variable portion of the condition.
‎2008 Mar 11 4:38 PM
Try:
SELECT * FROM cdpos
WHERE tabkey LIKE '000030_____PR00%'. <== UnderscoresRob
‎2008 Mar 11 4:49 PM