Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Like used in select statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
ajayvamsi
Currently Banned

Active User


Joined: 21 Jul 2005
Posts: 61
Location: Hyderabad

PostPosted: Sat Nov 12, 2005 12:17 pm    Post subject: Like used in select statement
Reply with quote

Hi Friends,

My requirement is I need to pick all the names in a column which r having percentage symbol in between the names...!!

Example::

let us suppose I have a table xyz with Name,Age as fields

Name Age

aaa%aaa 11
bbbbbbbb 12
cc%ccccc 45
d%ccccc 12

please help me to write a query to pick out all the Names like::
aaa%aaa
cc%ccccc
d%ccccc

Thanks in advance,
ajay
Back to top
View user's profile Send private message
References
chowdamhemalatha

New User


Joined: 25 Sep 2005
Posts: 2
Location: bangalore

PostPosted: Sun Nov 13, 2005 11:32 am    Post subject: Re: Like used in select statement
Reply with quote

Hi,

u can use LIKE clause in the SELECT stmt as shown below.

SELECT col1 FROM tab1 WHERE col1 LIKE '_%%'

Rgds,
Hema.
Back to top
View user's profile Send private message
reshma

New User


Joined: 10 Sep 2005
Posts: 9
Location: software engineer

PostPosted: Sun Nov 13, 2005 12:15 pm    Post subject: Re: Like used in select statement
Reply with quote

hema,

i was confused with ur query ..in the above said query by u ,u should have mentioned where col1 like '_%%%' ....tell me if iam wrong

regards,
reshma
Back to top
View user's profile Send private message
ajayvamsi
Currently Banned

Active User


Joined: 21 Jul 2005
Posts: 61
Location: Hyderabad

PostPosted: Sun Nov 13, 2005 2:52 pm    Post subject: Re: Like used in select statement
Reply with quote

Hema,
I am confused with the query..!! I heard that we need to go usling for "Escape"

Please correct here

select name from xyz where name like '%+%sdfdf' escape '+';
Is this wrong...!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1