2007 Mar 20 9:08 PM
Hi,
i have data in a table where for a field it has data ending with 123, 124, 125 etc .
in my select query i want to select data based on the ending data like 123, 124 , 125 .
example : abc123, xyz123 . i need to pull all data ending with 123.
how do i write that in my select statment .
can anyone let me know . thanks in advance.
Ry.
2007 Mar 20 10:20 PM
Hi,
Please try this.
concatenate '%' var1 into var2.
SELECT *
FROM <ztable>
INTO TABLE <itab>
WHERE <field1> = var1
AND <field2> like var2.
Regards,
Ferry Lianto
Please reward points if helpful.
2007 Mar 20 9:11 PM
Hi,
Use LIKE statement..
Ex..
SELECT * FROM xxx
WHERE field LIKE '%123'.
Thanks,
Naren
2007 Mar 20 9:13 PM
naren ,
thank you for the reply , the problem is i am passing this 123 into a character field .
ex: 123 to VAR
so in my query i gave as '%VAR'. the query was unsucessful . am i missing something , let me know
Regards,
Ry
2007 Mar 20 9:16 PM
Hi,
Please try this.
RANGES: R_FIELD FOR ZTABLE-FIELD.
R_FIELD-SIGN = 'I'.
R_FIELD-OPTION = 'CP'.
R_FIELD-LOW = '*123'.
APPEND R_FIELD.
R_FIELD-SIGN = 'I'.
R_FIELD-OPTION = 'CP'.
R_FIELD-LOW = '*124'.
APPEND R_FIELD.
R_FIELD-SIGN = 'I'.
R_FIELD-OPTION = 'CP'.
R_FIELD-LOW = '*125'.
APPEND R_FIELD.
SELECT FIELD
INTO TABLE ITAB
FROM ZTABLE
WHERE FIELD IN R_FIELD.
Regards,
Ferry Lianto
2007 Mar 20 9:47 PM
Hi Ferry Lianto ,
thank you for your reply my req is like this
move *123 into Var2. this is of char type C .
SELECT * FROM <table > INTO ,itab> WHERE <table-field> = var1 AND <table-field1> = ' %var2' .
but this is not working , can you let me know where exactly is the issue .
2007 Mar 20 9:55 PM
Hi,
Pleas try this.
data: var2 like ztable-field2.
move '%123' to var2.
SELECT *
FROM <ztable>
INTO TABLE <itab>
WHERE <field1> = var1
AND <field2> like var2.
Regards,
Ferry Lianto
2007 Mar 20 10:09 PM
Ferry,
Here i have to move '%var1' to var2 as var1 is dynamic value .
so i am not able to populate the content of the variable.
can you help me out on this .
Ry.
2007 Mar 20 10:20 PM
Hi,
Please try this.
concatenate '%' var1 into var2.
SELECT *
FROM <ztable>
INTO TABLE <itab>
WHERE <field1> = var1
AND <field2> like var2.
Regards,
Ferry Lianto
Please reward points if helpful.