Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select with like %

jyothsna1234
Explorer
0 Kudos

Hi,

I am going through some of SAP tutorials and found the following:

SELECT * FROM SPFLI WHERE CITYFROM LIKE '_R%'.

WRITE: /10 SPFLI-CARRID, 20 SPFLI-CONNID,

30 SPFLI-CITYFROM.

ENDSELECT.

following is my resulting list which doesnot include SINGAPORE.. Can someone explain why?

Thanks

JP

3 REPLIES 3

anujawani2426
Active Participant

Hi,

I tried the below query it's working. if you write underscore before R then it will consider you are looking for the word with the second character as R and if you write %R% then it will look for the word with R character.

SELECT * FROM SPFLI WHERE CITYFROM LIKE '%R%'.
WRITE: /10 SPFLI-CARRID, 20 SPFLI-CONNID,
30 SPFLI-CITYFROM.
ENDSELECT.

I hope this helpful.

Regards,

Anuja Kawadiwale

venkateswaran_k
Active Contributor

Hi

As per your where clause

WHERE CITYFROM LIKE '_r%'

--Finds ALL values that have "R" in the second position of the string.

raymond_giuseppi
Active Contributor

Review your course materials, % represents 0, 1 or multiple characters, _ represent a single character.

Can you guess your mistake?