Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
View previous topic :: :: View next topic  
Author Message
ajayvamsi
Currently Banned

New User


Joined: 21 Jul 2005
Posts: 56
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

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

New User


Joined: 21 Jul 2005
Posts: 56
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us