Replacing text on query..
Hello all. I was wandering if it was possible to do a general replacement of text on a query. What I want to do is for any fields that equal 'false' to be replaced with 0 and any fields that equal 'true' be replaced with 1. Now I know you can do if statements, but I have a whole bunch of fields and don't really want to go down the route on all of the fields. But if I have to I will. Thanks for the advice! -Nick -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Replacing text on query..
Take a look at the REPLACE() function: http://www.mysql.com/doc/en/String_functions.html#IDX1202 Regards, Mike Hillyer www.vbmysql.com -Original Message- From: Nick Stuart [mailto:[EMAIL PROTECTED] Sent: Monday, June 23, 2003 8:58 AM To: MySQL List Subject: Replacing text on query.. Hello all. I was wandering if it was possible to do a general replacement of text on a query. What I want to do is for any fields that equal 'false' to be replaced with 0 and any fields that equal 'true' be replaced with 1. Now I know you can do if statements, but I have a whole bunch of fields and don't really want to go down the route on all of the fields. But if I have to I will. Thanks for the advice! -Nick -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Replacing text on query..
Thanks for pointing that one out. Unfortunately relplace(table.*, ...) does not work (syntax error) so I'll stil have to go through each field individually. This will be two statements per-field which kinda stinks, but oh well. Thanks again! -Nick On Mon, 2003-06-23 at 11:10, Mike Hillyer wrote: Take a look at the REPLACE() function: http://www.mysql.com/doc/en/String_functions.html#IDX1202 Regards, Mike Hillyer www.vbmysql.com -Original Message- From: Nick Stuart [mailto:[EMAIL PROTECTED] Sent: Monday, June 23, 2003 8:58 AM To: MySQL List Subject: Replacing text on query.. Hello all. I was wandering if it was possible to do a general replacement of text on a query. What I want to do is for any fields that equal 'false' to be replaced with 0 and any fields that equal 'true' be replaced with 1. Now I know you can do if statements, but I have a whole bunch of fields and don't really want to go down the route on all of the fields. But if I have to I will. Thanks for the advice! -Nick -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql? [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]