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 > MySQL > SELECT fields with igoring zero before strings

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-15-07, 08:28
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 133
SELECT fields with igoring zero before strings

hi
i want to write a select query which ignore zeros before the string.
for example if fld1='007Sh980', my query must return '7Sh980'.
anyone can help?
Reply With Quote
  #2 (permalink)  
Old 10-15-07, 09:20
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
EDIT: Actually, this is wrong, so ignore it
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 10-15-07, 15:35
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 133
is it possible with mysql function? if it is, plz recommend best func for this
Reply With Quote
  #4 (permalink)  
Old 10-15-07, 15:49
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
SELECT TRIM(LEADING '0' FROM fld1) as trimmed_fld1 ...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 10-16-07, 16:25
ortho ortho is offline
Registered User
 
Join Date: Nov 2006
Location: Quebec
Posts: 172
Wow interesting I didn't know that use of TRIM.
Thank you, I'll use that functionality for sure!
__________________
Less is more.
How long is now?
http://www.lesouterrain.com
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