Re: LOAD DATA IF?
I dont want it to INSERT that row. Sample.txt name;category;price samsung;dvd;60 siemens;mobile;40 none;none;0 Say i dont want to insert rows where category is mobile or price <= 0. So in this case only the 'samsung;dvd;60' row would be inserted. Is this possible? Quoting Paul DuBois <[EMAIL PROTECTED]>: > At 1:16 +0100 11/3/05, John thegimper wrote: > >Is it possible to specify and IF statement or IGNORE statement when > >useing LOAD > >DATA? > >Example > > > >SET price = IF PRICE(< 20) THEN IGNORE > >SET price = IGNORE IF <20 > > What is the semantics of IGNORE? What do you expect to happen? > > -- > Paul DuBois, MySQL Documentation Team > Madison, Wisconsin, USA > MySQL AB, www.mysql.com > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
LOAD DATA IF?
Is it possible to specify and IF statement or IGNORE statement when useing LOAD DATA? Example SET price = IF PRICE(< 20) THEN IGNORE SET price = IGNORE IF <20 - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
LOAD DATA INFILE and SET REPLACE
Why cant i get this to work? The name dont get replaced... :P LOAD DATA LOCAL INFILE '/tmp/myfile.txt' INTO TABLE cache FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' IGNORE 1 LINES (name) SET name = REPLACE(name, 'Coke', 'Pepsi'); - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL REGEXP problems...
Ok how can i mix boolean and regexp searches? SELECT * FROM tbl WHERE MATCH (name) AGAINST ('TEST' IN BOOLEAN MODE) OR name REGEXP 'TEST'; That dont work :( Quoting [EMAIL PROTECTED]: > John thegimper <[EMAIL PROTECTED]> wrote on 08/22/2005 04:55:46 AM: > > > my host dont want to change the ft_min_word_len it´s now at 4 chars > > and i need > > to do searches with only 2 chars. > > > > Quoting Jasper Bryant-Greene <[EMAIL PROTECTED]>: > > > > > John thegimper wrote: > > > > Thanks so there is no operator that tells mysql that both words > must > > > match? > > > > > > > > "one|two" is equal to "one OR two" > > > > I want an operator that is equal to "one AND two" but i guess i > will > > > have to > > > > use match in boolean mode for that? > > > > > > Why not use full-text searching instead of regexp? > > > > > > Jasper > > > > > > -- > > > MySQL General Mailing List > > > For list archives: http://lists.mysql.com/mysql > > > To unsubscribe: > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > There is nothing stopping you from combining FT searches with REGEXP > searches. Put the terms with 4+ characters into the FT condition and the > > rest can be munged into some flavor of REGEXP condition. An alternative > is > to build a list of PKs for the records that have *any* term you need in > it > then hitting that list looking for how many terms matched. There are SO > many ways to approach this kind of search but you are definitely on the > right track by building and using FT indexes along with the REGEXP. > > Shawn Green > Database Administrator > Unimin Corporation - Spruce Pine - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Please help me: Boolean fulltext searches, AND instead of OR
This is what i need: Posted by gogman on Monday May 5 2003, @10:42am on the mysql website: MySQL defaults to an 'OR'. Example: 'dog cat' = 'dog OR cat'. Most fulltext search engines default to an 'AND'. These include: AltaVista, Fast Search, Google, Hotbot, Lycos, Northern Light and Yahoo. Excite is an exception that defaults to an 'OR'. New Feature: set-variable = ft_boolean_default='AND' vs 'OR' ('OR' would be the default setting so as to not break older code) With a 'AND' default 'OR' would have to be explicit. Example: 'dog cat' = 'dog AND cat', 'dog OR cat' - requires 'OR' to be set. Performance tests are indicating a 5-7 times increase in search speed with "AND" vs "OR" statements. ------ I have done some searches on google and found several people wanting to do the same... but no solutions. Quoting John thegimper <[EMAIL PROTECTED]>: > Is there still no solution for this? Every large searchengine works like > this. > > Quoting: > > > > > > Hi that works fine only now if a user puts + in front of a word that > > word > > becomes optional = OR? > > What i would like is the search to work exactly like before only that > it > > > > defaults to AND instead of OR. > > Almost every search engine i have tried, google etc. works like this. > > "black horse cat dog" only show results with all words present. > > > > This is what i did, set global ft_boolean_syntax = ' +-><()~*:""&|' > > > > I really appreciate your help!! > > > > >From: Sergei Golubchik <[EMAIL PROTECTED]> > > >To: Jessica Svensson <[EMAIL PROTECTED]> > > >CC: [EMAIL PROTECTED] > > >Subject: Re: Please help me: Boolean fulltext searches, AND instead > of > > OR > > >Date: Wed, 23 Mar 2005 22:32:49 +0100 > > > > > >Hi! > > > > > >On Mar 23, Jessica Svensson wrote: > > > > Is there any way i can get results with AND instead of OR? > > > > Trying to search for "black cat" should only return records that > > >contains > > > > both black and cat. > > > > > > > > I'm using the following code to get my result: > > > > > > > > SELECT * FROM `searchtbl` WHERE MATCH (text) AGAINST ('black cat' > IN > > > > BOOLEAN MODE); > > > > > > > > sure there must be an easy way to change the default word > separator > > to > > >AND > > > > instead of OR? > > > > > >There is. See ft_boolean_syntax variable - it defines what characters > > is > > >used for each operator. In particular it defines '+' for "must be > > >present" and a space ' ' for "optionally present" words. > > > > > >You want to put the space first (for "must be present" words) > > > > > >Regards, > > >Sergei > > > > > >-- > > >__ ___ ___ __ > > > / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[EMAIL PROTECTED]> > > > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer > > >/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany > > ><___/ www.mysql.com > > > > _ > > Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/ > > > > > > > > > - > FREE E-MAIL IN 1 MINUTE! > - [EMAIL PROTECTED] - http://www.pc.nu > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Please help me: Boolean fulltext searches, AND instead of OR
Is there still no solution for this? Every large searchengine works like this. Quoting: > > > Hi that works fine only now if a user puts + in front of a word that > word > becomes optional = OR? > What i would like is the search to work exactly like before only that it > > defaults to AND instead of OR. > Almost every search engine i have tried, google etc. works like this. > "black horse cat dog" only show results with all words present. > > This is what i did, set global ft_boolean_syntax = ' +-><()~*:""&|' > > I really appreciate your help!! > > >From: Sergei Golubchik <[EMAIL PROTECTED]> > >To: Jessica Svensson <[EMAIL PROTECTED]> > >CC: [EMAIL PROTECTED] > >Subject: Re: Please help me: Boolean fulltext searches, AND instead of > OR > >Date: Wed, 23 Mar 2005 22:32:49 +0100 > > > >Hi! > > > >On Mar 23, Jessica Svensson wrote: > > > Is there any way i can get results with AND instead of OR? > > > Trying to search for "black cat" should only return records that > >contains > > > both black and cat. > > > > > > I'm using the following code to get my result: > > > > > > SELECT * FROM `searchtbl` WHERE MATCH (text) AGAINST ('black cat' IN > > > BOOLEAN MODE); > > > > > > sure there must be an easy way to change the default word separator > to > >AND > > > instead of OR? > > > >There is. See ft_boolean_syntax variable - it defines what characters > is > >used for each operator. In particular it defines '+' for "must be > >present" and a space ' ' for "optionally present" words. > > > >You want to put the space first (for "must be present" words) > > > >Regards, > >Sergei > > > >-- > >__ ___ ___ __ > > / |/ /_ __/ __/ __ \/ / Sergei Golubchik <[EMAIL PROTECTED]> > > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer > >/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany > ><___/ www.mysql.com > > _ > Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/ > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL REGEXP problems...
my host dont want to change the ft_min_word_len it´s now at 4 chars and i need to do searches with only 2 chars. Quoting Jasper Bryant-Greene <[EMAIL PROTECTED]>: > John thegimper wrote: > > Thanks so there is no operator that tells mysql that both words must > match? > > > > "one|two" is equal to "one OR two" > > I want an operator that is equal to "one AND two" but i guess i will > have to > > use match in boolean mode for that? > > Why not use full-text searching instead of regexp? > > Jasper > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL REGEXP problems...
Thanks so there is no operator that tells mysql that both words must match? "one|two" is equal to "one OR two" I want an operator that is equal to "one AND two" but i guess i will have to use match in boolean mode for that? Quoting Enrique Sanchez Vela <[EMAIL PROTECTED]>: > > John, > > using 'one.*two|two.*one' would do it. :) > > regards, > esv. > > > --- John thegimper <[EMAIL PROTECTED]> wrote: > > > ok just figured out that if the database contains > > "one and one is two" > > and i use regexp to search for "one two" it will not > > match. > > If i search for "one(.*)two" it will. > > But how can i make it match if i search for "two > > one" ? > > > > Quoting John thegimper <[EMAIL PROTECTED]>: > > > > > Here is another user with the same problem > > > > > > http://forums.pcworld.co.nz/archive/index.php/t-34536.html > > > > > > Maybe his explanation is better :) > > > > > > Quoting John thegimper <[EMAIL PROTECTED]>: > > > > > > > SELECT * FROM tbl WHERE item REGEXP > > 'SEARCHSTRING' > > > > > > > > Database holds: > > > > SAMSUNG IDE 40GB 7200RPM > > > > > > > > Search for > > > > SAMSUNG IDE 7200RPM = 0 RESULTS > > > > SAMSUNG 40GB 7200RPM = 0 RESULTS > > > > SAMSUNG +40GB +7200RPM = 0 RESULTS > > > > SAMSUNG IDE 40GB = 1 RESULT > > > > > > > > How do i need to change the SEARCHSTRING to use > > AND for each word? > > > > SAMSUNG 40GB should return one result. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > > FREE E-MAIL IN 1 MINUTE! > > > > - [EMAIL PROTECTED] - http://www.pc.nu > > > > > > > > -- > > > > MySQL General Mailing List > > > > For list archives: http://lists.mysql.com/mysql > > > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > - > > > FREE E-MAIL IN 1 MINUTE! > > > - [EMAIL PROTECTED] - http://www.pc.nu > > > > > > -- > > > MySQL General Mailing List > > > For list archives: http://lists.mysql.com/mysql > > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > - > > FREE E-MAIL IN 1 MINUTE! > > - [EMAIL PROTECTED] - http://www.pc.nu > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: > > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > Enrique Sanchez Vela > email: [EMAIL PROTECTED] > - > It's often easier to fight for one's||We live in the outer > space > principles than to live up to them||Rev. Kay Greenleaf > Adlai Stevenson|| > > > > > Start your day with Yahoo! - make it your home page > http://www.yahoo.com/r/hs > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL REGEXP problems...
ok just figured out that if the database contains "one and one is two" and i use regexp to search for "one two" it will not match. If i search for "one(.*)two" it will. But how can i make it match if i search for "two one" ? Quoting John thegimper <[EMAIL PROTECTED]>: > Here is another user with the same problem > http://forums.pcworld.co.nz/archive/index.php/t-34536.html > > Maybe his explanation is better :) > > Quoting John thegimper <[EMAIL PROTECTED]>: > > > SELECT * FROM tbl WHERE item REGEXP 'SEARCHSTRING' > > > > Database holds: > > SAMSUNG IDE 40GB 7200RPM > > > > Search for > > SAMSUNG IDE 7200RPM = 0 RESULTS > > SAMSUNG 40GB 7200RPM = 0 RESULTS > > SAMSUNG +40GB +7200RPM = 0 RESULTS > > SAMSUNG IDE 40GB = 1 RESULT > > > > How do i need to change the SEARCHSTRING to use AND for each word? > > SAMSUNG 40GB should return one result. > > > > > > > > > > > > > > > > > > - > > FREE E-MAIL IN 1 MINUTE! > > - [EMAIL PROTECTED] - http://www.pc.nu > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > > - > FREE E-MAIL IN 1 MINUTE! > - [EMAIL PROTECTED] - http://www.pc.nu > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL REGEXP problems...
Here is another user with the same problem http://forums.pcworld.co.nz/archive/index.php/t-34536.html Maybe his explanation is better :) Quoting John thegimper <[EMAIL PROTECTED]>: > SELECT * FROM tbl WHERE item REGEXP 'SEARCHSTRING' > > Database holds: > SAMSUNG IDE 40GB 7200RPM > > Search for > SAMSUNG IDE 7200RPM = 0 RESULTS > SAMSUNG 40GB 7200RPM = 0 RESULTS > SAMSUNG +40GB +7200RPM = 0 RESULTS > SAMSUNG IDE 40GB = 1 RESULT > > How do i need to change the SEARCHSTRING to use AND for each word? > SAMSUNG 40GB should return one result. > > > > > > > > > - > FREE E-MAIL IN 1 MINUTE! > - [EMAIL PROTECTED] - http://www.pc.nu > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
MySQL REGEXP problems...
SELECT * FROM tbl WHERE item REGEXP 'SEARCHSTRING' Database holds: SAMSUNG IDE 40GB 7200RPM Search for SAMSUNG IDE 7200RPM = 0 RESULTS SAMSUNG 40GB 7200RPM = 0 RESULTS SAMSUNG +40GB +7200RPM = 0 RESULTS SAMSUNG IDE 40GB = 1 RESULT How do i need to change the SEARCHSTRING to use AND for each word? SAMSUNG 40GB should return one result. - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Is there an easy way to copy a table between two mysql servers?
Thanks, but that copies the whole database right? Can i specify only one table? Quoting Pooly <[EMAIL PROTECTED]>: > If you have a mysqlclient an an access to the command line, you can > directly pipe it ! > > mysqldump -h yourhost.com -u username -ppasswd mydatabase | mysql -h > yournewhost.som -u newuser -ppasswd newdatabase > > that's it ! > otherwise, yes dump/export. > > 2005/8/20, John thegimper <[EMAIL PROTECTED]>: > > Is there an easy way to copy a table between two mysql servers? Or do > i need to > > export and then import? I´m using php btw. > > > > Thanks, > > Johhn > > > > - > > FREE E-MAIL IN 1 MINUTE! > > - [EMAIL PROTECTED] - http://www.pc.nu > > > > -- > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > -- > Pooly > Webzine Rock : http://www.w-fenec.org/ > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Is there an easy way to copy a table between two mysql servers?
Is there an easy way to copy a table between two mysql servers? Or do i need to export and then import? I´m using php btw. Thanks, Johhn - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]