If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > please HELP for writing sql statement!!!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-23-07, 12:09
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
please HELP for writing sql statement!!!!!

Hi All,

I use db2 v8.2.3 and aix 5.2

I need to retrive some last name that have unkown space before "MR" from "LAST_NAME (varchar (128)) column of table TAB1.

e.g.

select last_name from TAB1 where last_name like ' '||MR ;

BUT I do not know the number of spaces before MR, do we have any function?

Thank you in advance for your help
Reply With Quote
  #2 (permalink)  
Old 01-23-07, 14:26
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Maybe something like:

where ltrim(last_name) = 'MR" and last_name <> 'MR'

Andy
Reply With Quote
  #3 (permalink)  
Old 01-23-07, 14:29
M_RAS M_RAS is offline
Registered User
 
Join Date: Sep 2003
Location: canada
Posts: 230
Quote:
Originally Posted by ARWinner
Maybe something like:

where ltrim(last_name) = 'MR" and last_name <> 'MR'

Andy
Thank you so much Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On