IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Like used in select statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ajayvamsi

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Sat Nov 12, 2005 12:17 pm
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
chowdamhemalatha

New User


Joined: 25 Sep 2005
Posts: 2
Location: bangalore

PostPosted: Sun Nov 13, 2005 11:32 am
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
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

New User


Joined: 21 Jul 2005
Posts: 56
Location: Hyderabad

PostPosted: Sun Nov 13, 2005 2:52 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Dynamically pass table name to a sele... DB2 2
No new posts SELECT from data change table DB2 5
No new posts Select two different counts from SQL... DB2 6
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Select a DB2 value in a specific deci... DB2 4
Search our Forums:

Back to Top