how to replace this data in a complex field?
I have a complex field named Inventory in a table named Table1 that can be different every time and is not guaranteed to contain what I need to replace. [[Thing1,Thing4,thing8,thing1,thing942,ACRE_PRC119_ID_29],[[thing1700,2],datthing4,pizza,water,apples,beans,coke-a-cola,rice,apples,apples,icecream,pizza,[7things,6],7things,7things,8things,tophats,tophats,762x39mmRU]] I need to replace ACRE_PRC119_ID_29 with ACRE_PRC119 and I cannot do this externally. I have PREG_REPLACE but I'm not sure how I would apply this to the database because it only SELECT's as far as I know. Any solutions? -Ikarus
Re: how to replace this data in a complex field?
On 07/31/2012 09:07 AM, Incarus Derp wrote: I need to replace ACRE_PRC119_ID_29 with ACRE_PRC119 and I cannot do this externally. I have PREG_REPLACE but I'm not sure how I would apply this to the database because it only SELECT's as far as I know. You could CREATE a TABLE from the SELECT. Isn't it? -- RMA. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: how to replace this data in a complex field?
- Original Message - From: Incarus Derp icarusd...@gmail.com I have a complex field named Inventory in a table named Table1 that can be different every time and is not guaranteed to contain what I need to replace. [[Thing1,Thing4,thing8,thing1,thing942,ACRE_PRC119_ID_29],[[thing1700,2],datthing4,pizza,water,apples,beans,coke-a-cola,rice,apples,apples,icecream,pizza,[7things,6],7things,7things,8things,tophats,tophats,762x39mmRU]] That looks more like a multidimensional array than a table, to me. I need to replace ACRE_PRC119_ID_29 with ACRE_PRC119 and I cannot do this externally. I have PREG_REPLACE but I'm not sure how I would apply this to the database because it only SELECT's as far as I know. ...and preg_replace is a PHP function, not a MySQL one. Are you sure you're on the right list? In any case, if you're looking to do this in MySQL, this is the function you're probably going to be using: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace If you're looking to do those substitutions on an mdarray in PHP, well, wrong list :-) I'll hint you that you're probably going to have to write a recursive function, though, if your mdarray has varying depth. -- Linux Bier Wanderung 2012, now also available in Belgium! August, 12 to 19, Diksmuide, Belgium - http://lbw2012.tuxera.be -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL server during query
Hi! Fred == Fred G Fred writes: Fred Thanks Dhaval. Putting the join condition before INTO outfile doesn't seem Fred to work, either. Fred When I try to use the same outfile name 'test123.csv' I get Error Code: Fred 1086 File 'test123.csv' already exists. But then when I try to find the Fred csv file on my computer, there is a folder with that name, but weird files Fred in it, none of which are a csv-- and certainly not in the location that I Fred thought it would be (the same directory that the .sql query is in). It's the mysqld server that is writing the .csv file. This means that the path is related to the mysql data directory and not to where your .sql file is. When using select into outfile it's always best to give a full path! Fred Additionally, when I try to identify a different path, such as 'C:\\' etc, Fred I get an error. This error is: Error Code: 1. Can't create/write to file Fred C:\test123.csv(Errocde: 2). This probably means that you don't have write access to C:\ Fred I tried running the query outputting to a different named .csv file, but it Fred is still just running... and seems like it was like yesterday where after Fred 10 minutes I will get the Error that the MySQL connection was lost. The reason that your connection is lost are ether: - There is timeout in the client you are using (The server never gives a timeout for running queries). - The mysqld server died (not likely but possible). - Some process in your system is killing quries that runs too long. One way to quickly check that things are working are by adding LIMIT 1 to the query. Fred Does anyone have an idea of what is going on? The query without exporting the file works fine, in about 12 sec/77 sec. I read online how to export MySQL queries into csv's, and I'm not sure what I am doing wrong. I keep getting the error: Error Code: 2013. Lost connection to MySQL server during query, where the duration/fetch values are 600.547 sec (~10 minutes). What is the exact error message? Which client are you using to do the query? It's strange that the query works fine when you are not using select into outfile. What MySQL version are you using Regards, Monty Creator of MySQL and MariaDB -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
query help
I've got a text field called source_recid. It stores half string half number like strings in it. Example shop.orders.32442 the syntax is DATABASENAME.TABLENAME.RECID My goal is to scan this col and find out the biggest RECID ( the integer) in it. So, in a case like this shop.orders.32442 shop.orders.82000 shop.orders.34442 It would be the record whose source_recid is shop.orders.82000. Why? Cause 82000 happens to be the largest integer. What SQL statement would get me that record? One option to this is to create a new column ( the_ids ) and move all the integers in it and then run something like this select source_recid from mytable where source_recid like 'shop.orders.%' order by the_ids DESC LIMIT 1 Is there a way to pull this off without going thru this step?
RE: How often the slave to pull data from master?
Thanks Shawn. Very informative and useful. David. The information contained in this e-mail and any attached documents may be privileged, confidential and protected from disclosure. If you are not the intended recipient you may not read, copy, distribute or use this information. If you have received this communication in error, please notify the sender immediately by replying to this message and then delete it from your system. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: query help
On Tue, Jul 31, 2012 at 7:02 PM, Haluk Karamete halukkaram...@gmail.com wrote: I've got a text field called source_recid. It stores half string half number like strings in it. Example shop.orders.32442 the syntax is DATABASENAME.TABLENAME.RECID My goal is to scan this col and find out the biggest RECID ( the integer) in it. So, in a case like this shop.orders.32442 shop.orders.82000 shop.orders.34442 It would be the record whose source_recid is shop.orders.82000. Why? Cause 82000 happens to be the largest integer. What SQL statement would get me that record? One option to this is to create a new column ( the_ids ) and move all the integers in it and then run something like this select source_recid from mytable where source_recid like 'shop.orders.%' order by the_ids DESC LIMIT 1 Is there a way to pull this off without going thru this step? Would substring work? SELECT SUBSTRING(recid, 13, column size) AS numbers FROM table ORDER BY numbers DESC -- Paul Halliday http://www.pintumbler.org/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
ADDATE Question
Hi, I just tried this query SELECT ADDDATE('2008-01-02', 31); and MySQL returns 323030382d30322d3032, while it should be 2008-02-02 Is there something wrong? Willy Mularto F300HD+MR18DE (NLC1725)