Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 09:28
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 69
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, 10:20
georgev georgev is offline
SQL Apprentice
 
Join Date: Jan 2007
Location: hiding
Posts: 8,143
EDIT: Actually, this is wrong, so ignore it
__________________
George
You only stop learning when you stop asking questions.
Reply With Quote
  #3 (permalink)  
Old 10-15-07, 16:35
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 69
is it possible with mysql function? if it is, plz recommend best func for this
Reply With Quote
  #4 (permalink)  
Old 10-15-07, 16:49
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 13,556
SELECT TRIM(LEADING '0' FROM fld1) as trimmed_fld1 ...
__________________
r937.com | rudy.ca

pre-order my book Simply SQL from Amazon
Reply With Quote
  #5 (permalink)  
Old 10-16-07, 17: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

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