Re: Need expert assistance with this (MySQL routine)
- From: scott Johnson <scottyj1@xxxxxxx>
- Date: Thu, 27 Oct 2005 16:45:36 -0700
If they are two different tables it could be as easy as:
"DELETE table2 from table2,table1 WHERE table2.column1 = table1.column1"
This will of course delete the row of table2 that has similar data in column of table1 and table2.
If you are just trying to clear the data out of a column in the same table:
<?php
/*
Connect to your DB
*/
$query = "SELECT table.column1 FROM table";
$result = mysql_query($query);
while($column = mysql_fetch_array($result)){
$column1 = $column['column1'];
$update = "UPDATE test SET column2 = ''
WHERE column2 = '$column1'";
mysql_query($update))
}
?>This is as basic as I can get it.
giancarlodirisioster@xxxxxxxxx wrote:
Everyone is usually so friendly and helpful in here, I need help with this:
I need a MySQL routine that takes one column of data and compares it to a second column of like data. What I want it to do is remove all instances of duplicate data from the second column only. Non-case sensitive. How would I accomplish this?
-- Scott Johnson http://www.seaforthsailingclub.com .
- Follow-Ups:
- Re: Need expert assistance with this (MySQL routine)
- From: giancarlodirisioster
- Re: Need expert assistance with this (MySQL routine)
- Prev by Date: $_POST and CSV File
- Next by Date: Re: Silly problem with output
- Previous by thread: $_POST and CSV File
- Next by thread: Re: Need expert assistance with this (MySQL routine)
- Index(es):
Relevant Pages
|