Update 175,000 Records In 1 Hit
I have just under 175,000 records in my database and need to create an MD5 hash of a certain field in each row.
I created a page to run on localhost which had the following
PHP
<?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("wordlist") or die(mysql_error()); if (isset($id)) { $id=$_GET['id']; } else { $id=Ƈ' } $GetThisWord_result = mysql_query(" SELECT * FROM word_list WHERE id=$id") or die(mysql_error()); $GetThisWord = mysql_query($GetThisWord_result); $GetThisWord = mysql_fetch_assoc($GetThisWord_result); $word=$GetThisWord['word']; if ($word=="") { header("Location: ./end.php"); } else { $query = "UPDATE word_list SET hash=MD5('$word') WHERE id='$id'"; mysql_query($query) or die(mysql_error()); $nextid=$id+1; header("Location: ./index.php?id=$nextid"); } ?>
But the browser keeps coming up saying theres an error as the page will just keep repeating itself after it's processed 20 rows.
Can I just enter
PHP
UPDATE word_list SET hash=MD5('$word') WHERE id='$id'
or simiilar into MySQL Front and let it do it all itself?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't UPDATE Records
I'm trying to update all records from table 'Products' in my DataBase despite of having no erros the records don't update. Here's the code: UPDATE `Produtos` SET `Estado` = '1' WHERE `Estado` = NULL ;
Update Records
Normally, an update on a record is done by: 1. retrieve & display the record details 2. html-form: change/update the record fields; 3. submit an update statement. Now, thus will cause problems when another user is also updating the same record. Now, what is common practice (or standard MySQL functionality?) to make sure that changes/updates in such a multi user php/mysql environment are dealt with properly? (e.g. record locking?), or comparing values of db-record with formfields to check whether an update has been executed during the time the up-date form was used? Loging time/date stamps? Checkin/checkout?
Records Were Update
I want to know, when issuing an UPDATE statement inside a stored procedure, how many records were updated.
Can't Update Records Of Several Table's
i've migrated our access database to mysql, now i get the following error, when i try to update the contents of a record it states that someone else has edited the record in the meantime (though this is not the case), all records in the table give the same error while trying to edit. i guess it has something to do with locks but i do not understand what has gone wrong. I'm using an access frontent connected with ODBC to the MySQL server wich containes the database.
Update Records In Table
i have installed a mysql server, and i have a problem with import record in database. the origine is a file txt or csv, the destination database contain also other records, and i must update the records into database
Insert Or Update Records
What's the best way to achieve this? To simplify the problem, lets say I have a table with two columns, 'id' and 'value'. Now, I want to pass an object through remoting (amfphp, irrelevant really but anyway) to either update existing rows or insert new ones. The object I'm passing has corresponding fields, and if there is a match on the 'id' field then update it, if not insert a new row. So I guess I need to first pull out all of the id's and compare them to the ones in my object, then seperate them up to ones that need updating, and ones that need inserting. I can't quite see what the best way of doing this is. Either in code e.g. PHP or is there a MySQL statement to do it the quick way?
Update A Set Of Records In One Single Query
My records contain a position, from 1 to n. This position is not the primary key. In normal conditions, the position of this records should be as follows: 1, 2, 3, 4, 5, 6, 7, 8, 9 . etc... One of my utitities is meant to check the consistency of the table - one of the things it has to do is scan the table as follows: SELECT position FROM employe_records WHERE employe_id = ? ORDER BY position From the result of this query I verify each entry (JDBC) one by one, looking for inconsistancies. In a for() loop I look at the value of position and check that they start from 1 and are incremented by one for each record. At the first inconsistency I come accross I want to run a query to update the records so it is consistant again - it is something like this: UPDATE employe_records SET position = updatedValue FROM employe_records WHERE employe_id = ? ORDER BY position This is not valid query of course - my question is what should my query look like?! How can I make 'updatedValue' incremented by one automatically so each of the records are updated from 1 to n.
How Can I Update A Set Of Records In One Single Query
My records contain a position, from 1 to n. This position is not the primary key. In normal conditions, the position of this records should be as follows: 1, 2, 3, 4, 5, 6, 7, 8, 9 .etc... One of my utitities is meant to check the consistency of the table - one of the things it has to do is scan the table as follows: SELECT position FROM employe_records WHERE employe_id = ? ORDER BY position From the result of this query I verify each entry (JDBC) one by one, looking for inconsistancies. In a for() loop I look at the value of position and check that they start from 1 and are incremented by one for each record. At the first inconsistency I come accross I want to run a query to update the records so it is consistant again - it is something like this: UPDATE employe_records SET position = updatedValue FROM employe_records WHERE employe_id = ? ORDER BY position This is not valid query of course - my question is what should my query look like?! How can I make 'updatedValue' incremented by one automatically so each of the records are updated from 1 to n.
Update Query On 14000 Records
Haing moved a large site from asp and access to php and mysql, I would like to change the way of my fields is delimited. Currently, the field contains user selection seperated by commas e.g. selection1, selection2, selection3 I would like to update this field on every row in the table and change all commas to pipes e.g. selection1|selection2|selection3 The table contains over 14000 records, and the field in question can contain anything up to 30 selections. Is this possible to do?
Can't Update Records When Using Linked Tables In Access
I have a linked table to MySQL 5.0 through MS Access 2003 that utilizes a timestamp field in order to prevent the #Deleted signature happening everytime I create a new record. However, when I attempt to update a previous record I receive the error message: "Reserved error (-7776)" and am subsequently prevented from updating any records. Please note, there are no errors when creating new records, only when I attempt to update an existing one. However, if I remove the timestamp field, updates occur without error. Has anyone else encountered this issue? How might I rectify it?
Count Related Records, But Show Records With NO Related Records Also
cl_items ======== it_id (pk) it_ownerid it_name cl_offers ======== off_id (pk) off_itid (fk) -> to it_id off_whoid My query needs to output ALL of the records in cl_items AND still show how many offers are on each item (from cl_offers) I can't get what I want through the GROUP BY because I want to show the records in cl_items which DO NOT have any offers on them yet also. Is there any way to do this with mysql only?
All Records From Table A - All Records From Table B - Join Alike Records
I am by no means a SQl Jedi as will be apparent by my question, but I can usually figure out a select statement on my own. I have one today though that really has me stumped. I am working in MySQlL 5. In My first select statement I get all my records from Table B SELECT `table_A`.`ITEM`, `table_A`.`DECSCRIPTION`, `table_A`.`UM`, `table_A`.`PHASE`, `table_B`.`Qty`, `table_B`.`Calc` as calculated FROM `table_A` Inner Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID` In my second statement I get my records that match in this case phase 401 in Table B and all my Table A records for phase 401. SELECT `table_A`.`ITEM`, `table_A`.`DECSCRIPTION`, `table_A`.`UM`, `table_A`.`PHASE`, `table_B`.`Qty`, `table_B`.`Calc` as calculated FROM `table_A` Left Outer Join `table_B` ON `req_itemlist`.`ITEM` = `table_B`.`ItemID` Where table_A.PHASE In ('401' ) Now I need to combine the Data of both recordsets. I need EVERYTHING in Table B, but I also need All Table A records that match the phase selection.... Can I write this one query or do I need to use a Temp table?
Complex Query - UPDATE Within UPDATE?
Edit: Before anyone leaves this thread, don't be put off by the regular expressions! They are not the problem, so please stay and read. OK, this query has got my head spinning. I am basically creating a query that goes through each product in a table to update the stock for that particular item with that particular size (i.e. I am talking about shoes - different models and each model has different sizes (uk kids 12 -> uk 11). With each shoe it does (or is meant to do) the following: 1. The PHP script that runs the query is looping through every size outside of the query 2. So for each of these sizes it checks to see whether the product it is currently on matches the size it is on 3. When it finds the size it is on, it then deducts the correct number of units from the stock table 4. The final WHERE clause makes sure this subquery inside the UPDATE only happens when the StockUpdated field of the Product table equals 0 (in other words, the stock hasn't been counted before) Basically what I need to do, is first to make sure what I currently have got does the above correctly but also I need the query to UPDATE the StockUpdated field to 1 only when it has been updated successfully. How could I do this? Unfortunately I cannot just add an extra update entry to the end of the query as this would update the StockUpdated field regardless of whether it has been properly counted or not. Here is the query I have so far (with a little simple PHP around it doing the loop): PHP $shoesizes = array(1 => 'ukk12','ukk13','uk1','uk2','uk3','uk4','uk5','uk6','uk7','uk8','uk9','uk10','uk11'); $numshoesizes = count($shoesizes); for($i = 1; $i < $numshoesizes; $i++) { $stockupdate = " UPDATE heelys_stock,items_ordered SET heelys_stock.size_".$shoesizes[$i]." = (SELECT CASE WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?( )?(Kids)?( )?( )?(UK)?( )?( )?(Kids)?( )?( )?[^0-9]12( )?(' -- if UK Kids 12 THEN heelys_stock.size_ukk12 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?( )?(Kids)?( )?( )?(UK)?( )?( )?(Kids)?( )?( )?[^0-9]13( )?(' -- if UK Kids 13 THEN heelys_stock.size_ukk13 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]1( )?(' -- if UK 1 THEN heelys_stock.size_uk1 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]2( )?(' -- if UK 2 THEN heelys_stock.size_uk2 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]3( )?(' -- if UK 3 THEN heelys_stock.size_uk3 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]4( )?(' -- if UK 4 THEN heelys_stock.size_uk4 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]5( )?(' -- if UK 5 THEN heelys_stock.size_uk5 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]6( )?(' -- if UK 6 THEN heelys_stock.size_uk6 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]7( )?(' -- if UK 7 THEN heelys_stock.size_uk7 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]8( )?(' -- if UK 8 THEN heelys_stock.size_uk8 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]9( )?(' -- if UK 9 THEN heelys_stock.size_uk9 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]10( )?(' -- if UK 10 THEN heelys_stock.size_uk10 - (items_ordered.Amount/items_ordered.Price) WHEN SUBSTRING_INDEX(items_ordered.Product,',',-1) REGEXP '( )?(UK)?( )?[^0-9]11( )?(' -- if UK 11 THEN heelys_stock.size_uk11 - (items_ordered.Amount/items_ordered.Price) FROM items_ordered WHERE items_ordered.StockUpdated = 0) WHERE (heelys_stock.id = (SELECT heelys_stock.id FROM heelys_stock,heelys_shoe WHERE SUBSTRING_INDEX(items_ordered.Product,',',1) = heelys_shoe.full_shoe_name)) , items_ordered.StockUpdated = 1" // at the moment this last update of the items_ordered table happens to every record!!! even if the other part of query fails // update stock for size $i mysql_query($stockupdate); } Hope someone can see how I can do this? I've been working on this query for 2 or 3 hours now and I've been making reasonable progress but now I am really stumped.
Update Replication, Force Update
Recently an error in the db on my master caused the slave to fail. I noticed this after a few days when I looked at the status and it said "Slave_SQL_Running: No". After looking further I saw what the error was on the master. What is the best method of re-synching the databases? Is there a command to force a re-replication or synch of the dbs? Would you delete the slave's db and update over? In this case, is there a command to pull the data down from the master?
Unable To Update - Have Update Priveledge
I've been granded update priveledge to tables in a few databases on our server: Select_priv ,Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, References_priv, Index_priv, Alter_priv, Create_tmp_table_priv, and Lock_tables_priv are all set to 'Y' for a selected database. I can connnect and read the data and data definitions just fine. I cannot insert, update, delete, create, or alter any table in this database. Our admin worked for a couple of hours yesterday trying to resolve the issue, but no joy. I've googled for this problem and the most relavent posts I've found were problems related with users not being able to connect. I can connect and I can read, I just can't do any of the other priviledges.
ON DUPLICATE KEY UPDATE - Don't Have A Key But Want To Update
This may seem like more of a PHP question but I will come onto the MySQL part in a minute. Basically I have a PHP script that lets users upload 2 different CSV files to different tables. The problem I have is that sometimes these CSV files are updated and then need to be reimported into the database through the script. I have made this script totally generic so that when you change the table that is being entered to the rest of the script will alter itself to import the correct CSV to that table. But a problem arises when I have a CSV file that contains each product sold and the shopper who bought the product (so the shopperID may appear in more than 1 row) - however this file does not have a unique id for each row meaning that when I use an INSERT INTO with a ON DUPLICATE KEY UPDATE... it will just insert more rows instead of updating rows because there is now key in the table. The format of the table is like this (with some example data to show you more clearly): +-----------+-------------+---------+------+--------+------+ | ShopperID | Product Code | Product | Price | Amount | Units | +-----------+-------------+---------+------+--------+------+ 546733 1315 prod 1 64.00 64.00 0 546733 1316 prod 2 43.99 43.99 0 OK just ignore the last 2 fields - that is a problem with the old system there was which does not add the units up right. Anyway basically I might have the same shopper ordering 2 things which will come up on different rows - I have 3 things I cannot do: 1. I can't make the ShopperID field the PRIMARY KEY because I have many times where there are 2 rows with the same shopper 2. And I cannot just do an UPDATE when it gets to a duplicate entry because it will overwrite every time it gets to a shopper that already exists. 3. I don't want to add a unique primary key to the CSV as this will mean that the system I am creating loses its ability of being automatic because the person (an admin) that uploads the file will have to make sure that it has that extra field which is auto incrementing. Does anyone have any ideas on how I can get round this? Here is my PHP function which contains the query: PHP // this function for insert data to csv function makeINSERTS($text, $table, $tablefields, $correctcsv){ $insert = array(); //make array for hold data insert $i = 0; $success = true; while(list($key, $val) = each($text)){ // Insert the data $insert[$i] = "INSERT INTO ".$table." VALUES('"; $insert[$i] .= implode("','", $val); $insert[$i] .= "') ON DUPLICATE KEY UPDATE "; foreach($tablefields as $k=>$field){ $insert[$i] .= "`$field`='{$val[$k]}',"; } $insert[$i] = substr($insert[$i],0,strlen($insert[$i])-1); // echo $insert[$i].'<p></p>' $result = mysql_query($insert[$i]); if(!$result) { echo 'FAILURE to insert/update any or all of the database form uploaded CSV!<br />' $success = false; die('Query failed: ' . mysql_error().'<br />'); } $i++; } if($success == true && $correctcsv == true){ echo 'SUCCESS in uploading the CSV file to the database!<br />' } else { } return $insert; }
Update Queries Do Not Always Update
We are running a MySQL database using PHP to create html pages and forms to update and add information to the db. Sometimes the update query works, sometimes it doesn't - or at least, not permanently. A new record may be added, but five minutes later it has sometimes, but not always, mysteriously disappeared. Where should I look for a solution? Is there a cache that MySQL creates that may be being accessed unwittingly? We are using the standard php and MySQL versions that come as standard on a Mac OS X Tiger 10.4.7 server. The browser we are using is Firefox 2.0.4.
Can't See Old Records
I really don't know much about mysql. We have an hardware device performing bandwidht management which we didn't even know it is using mysql until it was broken down. After we solved the problem, we saw that the operationg system running in the device is linux (and old version) and the database is mysql. The problem is that we can't see the old data eventhough when I view the binary ISD file I can see the whole data including the olds. But the management program doesn't show the old data. When I reenter new definitions from the management program, I can see that they are written into the ISD files. ISD files contains both old and new records but I can see the only new files. Does that mean the index files are curropted? If so, How can I recreate indexes or recover them?
Records That Are Only From 3 Pm To 6 Pm
I have a field in my table called time which is a datetime field. The format of the data is like these below: 2006-07-12 17:55:19 2006-07-11 16:31:34 ...... I would like to get every records that are only from 3 pm to 6 pm. Is there any query where I can check for the hour of a datetime field?
Top 5 Records - ASP
I have an ASP application talking to a MySQL database. All works fine but: 1) I can't figure out how to select just the latest 5 records in a table. 2) SELECT LAST_INSERT_ID() doesn't work, it just returns 0. 3) I need to select the 'recordid' (held in the first field and is the PK) of the latest record.
Getting Last 12 Records
I am trying to get just the last 12 records from a table. I have tried this but get no results. SELECT TITLE, ARTIST, STYLE, MEDIUM, FORMAT, CATEGORY, WIDTH, HEIGHT, SPRICE, FILENAME, NUM FROM PICTURES WHERE CUSNUM='YES' AND ARTALLOW<>'NO' ORDER BY DESC LIMIT 12
Get Records From The End
my question is how can I get the last 20 rows from a table without changing the order the table is.
Certain Records
Code: insert into users (username, password, email) select user , ID, email from selex.empleados_selex but i want to copy only the records where its status is "working" something like: insert into users (username, password, email) select user , ID, email from selex.empleados_selex WHERE status =´working`
Pf Records
Is it possible to specify the limit of records that can be entered in the table.
No Records In DB
I connected to the DB like this: Set rsP1000 = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT [G2P] FROM tblClients WHERE ClientID = '" & strID & "' AND GTime2 ='10:00a'" rsP1000.Open strSQL, adoCon I was wondering if the connection does not return any results, how do I display nothing. It keeps failing out because there is no record.
Records
I have a mysql database running on Mysql version 3.23.53 on a Red Hat Linux 7.2. In the database there is a single table with over 150,000 records. Unfortunately, the performance of that table is very poor, comparing to other tables in the same database.
Get Records
I have one table (members) and a linked table (payments) and I trying to retrieve all the records in the members table that don't have a record in the payments table.The payments table is linked to the members table by memberId. Does anyone know how I would compare the two tables and bring back only the members that don't have a record in the payments table?
To Many Records
This query is getting me rows which dont = $cid can anyone tell me why? =x Code: "SELECT event.eventName, event.eventMonth, event.eventYear, exhibitor.standNum FROM event, exhibitor WHERE exhibitor.companyID = event.companyID AND exhibitor.companyID = '$cid'"
Records
I want to extract those values whose modificatio dates are few days older using the following sql [SQL] select status from note where mdate<=date_add(date('Y-m-d'),interval -2 day) and status='Selected' and id=$r[0]; [/SQL] but the comparison 'mdate<=date_add(date('Y-m-d'),interval -2 day)' doing nothing. I have checked it in db. There is no error too. How to correct that?
40 Records
This is to gather a sample from the database. I need to select 40 consecutive records every 1001st record. So I would need records 1001-1040 and records 2002-2041 and so on. Anyone have a clue on how to write the query for this?
Records 1 To 10, 10 To 20 Etc
im not sure how to do this or what to search for so any help would be great. basically if i do a (select * from table) how do i get only the fiorst ten matches like records 1 to 10 then like on another page id have records 10 to 20. i thought i coudld use limit but when i do say SELECT * FROM `sale` LIMIT 2 , 4 i get 4 results back instead of what i thought would have been results ows 2 to 4
10.000.000 Records
I've got some experience building PHP/MySQL websites, but the databases in these websites never contained more than a couple of thousand records. Now I've been asked to build a website with a database containing a table with roughly 10 million records.This amount of records gives me the creeps, to tell you the truth. It's simple records, containing just 2 columns. The only thing a script would have to do is check wether a code is in the database or not. Can I use standard PHP scripting methods and SQL queries, or does this amount of records demand a totally different approach? I can imagine an application getting very slow when it has to work with a huge recordset like this. What do I have to consider before I decide to build this site (or not)?
How To Get Subtotals Along With All Records?
I have a cart full of items. Each item belongs to a category - so, there might be 3 items in the cart belonging to Category A, 2 to Category B, etc. If possible I'd like to select all items from the cart, and at the same time get the subtotal for each category (so I can then say "$500 was spent on category A" and so forth). I am currently exploring the SUM/GROUP BY avenue, but I will admit I'm not at all sure of what I'm doing...
Counting Records
Got a question for you that is really stumping me. I have 3 tables job_jobs ------------ job_id job_name . . . job_cats ------------- cat_id cat_name . . . job_jobsToCats ------------- jtc_id job_id cat_id *************** ok i have those 3 tables to categorise the jobs on the site and im trying to build a query that will essentially get all categry names and display the number of jobs in that category so when i output it i will get accounting (12) admin(2) etc etc
Records That Don't Match
I have two tables. One has bar information. The second has the bar's drinks. They are tied by 'bar_id'. So there are either one or multiple records in table 'bar_drinks' for a given bar_id. The problem is finding the bars that don't exist in the bar_drinks table. I tried several ways, even a subselect, but get an error of more than one row existing: SELECT bar_name FROM bar WHERE bar_id = (select distinct bar_id from bar_drinks) I see the error here, but really am stumped how to achieve this....
How To Get Records Between Two Dates
In database I have stored dates in ��-00-00 00:00:00' format. And from user I am getting dates in 'mm/dd/yyyy' format. 1- How can I get records from database between user entered dates.
How To Get 15 Minutes Old Records
Scenario : My system enables a record on zero minute of every hour [through cron job]. Lets suppose right now time is 10:10 AM. Query: My query is that -> 1- How can I get all records which are enabled before (1 hour and 15 minutes) of the current time?
Records Being Removed
Can anyone tell me why records would keep being deleted on an mySQL database? I don't think the server is being hacked - but how could I make it more secure (it is Windows 2000)?
Deleting Records
I have the following table PHP +--------+-------+---------------------+ | postID | catID | date | +--------+-------+---------------------+ | 125 | 0 | 2006-08-18 17:02:40 | | 126 | 0 | 2006-08-18 17:03:02 | | 123 | 0 | 2006-08-18 17:03:13 | | 131 | 0 | 2006-08-25 12:34:20 | | 130 | 0 | 2006-08-25 12:34:49 | | 135 | 0 | 2006-08-28 15:14:13 | | 137 | 0 | 2006-08-28 18:23:27 | | 138 | 0 | 2006-08-28 15:43:15 | | 139 | 0 | 2006-08-29 00:17:42 | | 140 | 0 | 2006-08-29 12:01:43 | +--------+-------+---------------------+ What i'd want to do is to setup a daily script to delete records from this table but only leave out 8 latest records. Is there a single sql query to do the deletion?
Selecting Top Records
I was posed a question in an interview that required me to select the top 3 records of table after doing a sort. I have been studying MySQL for the last 6 months or so and don't recall that capability in MySQL. I know it is available in Oracle and SQL Server. Is this possible in MySQL?
Records Disappear
Has anyone experienced their records disappearing. I have 8 tables in a DB that each table rougly contain 10 to 900 records. the program that i had developed is a PHP program. I checked the site the other day and their was some data missing. i checked the DB and i noticed zero records in a few tables. the only thing that i can think of is in Cpanel(WHM) I exported the DB the day before for my weekley backups. I export all my DB in PHPmyadmin every week, just incase my server crashes. I have a dedicated server.
Duplicating Records...
I have looked long n hard at the Insert Select as being the answer to my need to create duplicate records. (Purpose is basically to allow someone to create a duplicate of an existing email template then modify it). I have tried all sorts of variations on: INSERT INTO emaillist SELECT * FROM emaillist WHERE emailid = #url.emailid# (inc trying IGNORE) but of course this throws an error over duplicate keys. All I want to do is to take Record A, duplicate it and have a new key assigned to it (the key is an autonumber field).
Duplicate Records
I've noticed what might be a bug. I'm using InnoDB tables to store some payment information. Included in the table is a DATETIME field that logs the exact time a payment was made to a client. The problem is that in one instance there are clearly duplicates of a payment record in the table. i.e. 3 records were inserted that have the exact same information including the same timestamp. I have checked the code making the INSERTs and it can't be that. It's just a simple INSERT query. Has anyone else noticed things like this and is there a solution?
Showing All The Records With The Same Name
I was wondering how to write an sql that'll say "show me all the records that have the same name" I have about 500 records, and i would like to know which of them have the same name (which is a column in my table).
|