On Friday 28 February 2003 22:00, Scott wrote: > I have a client word database and I am attempting to create a database with > the results from a select that splits the description field based on the > spaces. > > When just executing the select command, the output is correct. When using > the create command with the select command, apparently the IF statement > result (0/1) is being placed into the field instead of the word. > > My Mysql version is: mysql Ver 12.12 Distrib 4.0.3-beta, for pc-linux-gnu > (i686) > > clientid description > -------- ----------------- > client1 chair couch piano > client2 bed dresser > client3 chair > client4 table stove couch > > > > drop table if exists wordsplit; > > ####create table wordsplit > > select clientid, > if(locate(' ',description)=0,trim(substring(description,1)), > trim(substring(description,1,locate(' ',description)))) as firstword, > if(locate(' ',trim(substring(description,locate(' ',description))))=0, > substring(trim(substring(description,locate(' ',description))),1), > substring(trim(substring(description,locate(' ',description))),1, > locate(' ',trim(substring(description,locate(' ',description)))))) as > secondword, > (trim(substring(ltrim(substring(description,locate(' ',description))), > locate(' ',ltrim(substring(description,locate(' ',description))))))) as > thirdword > from clientword order by clientid;
Could you test it on 4.0.11 version of MySQL server? If you get the same result, please, provide a repeatable test case with table structure (output of SHOW CREATE TABLE or mysqldump). -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- 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