RE: String Functions
Try the Replace function replace the `-` character with `` -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 10:09 AM To: MYSQL-List (E-mail) Subject: String Functions Is there any function to strip non numeric characters from a string? Such that FUNCTION('1-(519)-473-3853') would return '15194733853' -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: String Functions
That I can do REPLACE(REPLACE(REPLACE(REPLACE(str,'(',''),')',''),'-',''),' ','') Looks kinda horrid to handle removing just four characters ( ) - and space And if any other characters end up in str, then they are not handled, and my formula is broken. So there is no functions that would do what I need? Anyone have some kind of formula (multiple functions perhaps) that would simulate what I need, something that would only return numeric characters? -Original Message- From: Victor Pendleton [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 11:15 AM To: Luc Foisy; MYSQL-List (E-mail) Subject: RE: String Functions Try the Replace function replace the `-` character with `` -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 10:09 AM To: MYSQL-List (E-mail) Subject: String Functions Is there any function to strip non numeric characters from a string? Such that FUNCTION('1-(519)-473-3853') would return '15194733853' -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: String Functions
What programming language are you using? You could write a method to compare each character and return only those 0-9 as the output and discard the rest. -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 10:26 AM To: Victor Pendleton; MYSQL-List (E-mail) Subject: RE: String Functions That I can do REPLACE(REPLACE(REPLACE(REPLACE(str,'(',''),')',''),'-',''),' ','') Looks kinda horrid to handle removing just four characters ( ) - and space And if any other characters end up in str, then they are not handled, and my formula is broken. So there is no functions that would do what I need? Anyone have some kind of formula (multiple functions perhaps) that would simulate what I need, something that would only return numeric characters? -Original Message- From: Victor Pendleton [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 11:15 AM To: Luc Foisy; MYSQL-List (E-mail) Subject: RE: String Functions Try the Replace function replace the `-` character with `` -Original Message- From: Luc Foisy [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 10:09 AM To: MYSQL-List (E-mail) Subject: String Functions Is there any function to strip non numeric characters from a string? Such that FUNCTION('1-(519)-473-3853') would return '15194733853' -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: String functions for GROUP BY clause
If you're using MySQL 4.1, you have the GROUP_CONCAT(expr) function. If not, then... i think someone has already done an UDF about this... Search the archives..or see this: http://www.cwts.nl/buter/misc/my-mysql.html -- Diana Soares On Wed, 2003-11-12 at 08:56, Ciprian Trofin wrote: Is there a way to use a string concatenating function in connection with a GROUP BY clause? I mean, for a one-to-many relation (like firm-stockholders relation), to catch a structure like: firm | stocholders f_1 | s_1; s_2; s_3 f_2 | s_4; s_5 f_3 | s_6 instead of firm | stocholders f_1 | s_1 f_1 | s_2 f_1 | s_3 f_2 | s_4 f_2 | s_5 f_3 | s_6 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: String functions for use in GROUP clause?
David Garamond [EMAIL PROTECTED] wrote: We can use SUM(), AVG(), COUNT(), etc. in GROUP clause. These are all numeric functions. Is it possible to use string functions as well? I know MIN() MAX() can be asciibetical for string fields, but wouldn't this be very handy/practical? SELECT division, G_CONCAT(, ,first_name) as nicks, COUNT(*) as num_nicks FROM employees GROUP BY division; will return: division nicks num_nicks - - sales John, David, Billy 3 accounting David, Mickey 2 techsupp Alice, Bob, Dennis, John4 rdLisa1 test 0 Other aggregate string functions might be G_MD5(), G_MAKE_SET(), G_SPAM_RATING() :-) Aggregate functions for sets might also be nifty to have sometimes. Here you can find list of group by functions: http://www.mysql.com/doc/en/GROUP-BY-Functions.html -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: String Functions and Date Format Living Together in Harmony?
At 12:39 -0400 9/20/02, Stanley, Jason wrote: hello all, i have the following selection in my query... DATE_FORMAT(Images.TIMESTAMP, '%a %b %d at %l:%i %p') as TIME now, i want to apply LCASE or LOWER to it, but i'm a little unsure how to handle the syntax with two sets of parentheses. The alias follows the entire expression, so it would be done like this: LCASE(DATE_FORMAT()) as TIME any insight? tia, j - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php