Re: Need expert assistance with this (MySQL routine)



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 .



Relevant Pages

  • Re: A Question on query efficiency
    ... table3 is much more wider, because of the second column. ... items from table2 for each single item from table1, ...
    (comp.databases.ms-sqlserver)
  • Re: Tricky Visual Basic Code help...
    ... moves the current record into a new record in table2. ... this with a little VBA code and a couple custom queries. ... Set a "pushFlag" column in the record in table1 to a specific ... If a duplicate is not found, ...
    (microsoft.public.access.formscoding)
  • Re: Help needed with importing XML
    ... You could add a gratuitous identity column to #temp and use ... Those examples showed how to decompose arbitrary XML in multiple ... table1 and table2. ... But there has to be something in the relational schema tying table1 ...
    (microsoft.public.sqlserver.xml)
  • Re: 2 column pulldown
    ... Allen Browne - Microsoft MVP. ... these field heading names come from Table2 since it is a lookup and so ... Table1 of course only has a single column name ... fieldX from Table1 is pulldown revealing candidate values of Table2. ...
    (microsoft.public.access.forms)
  • Re: Sliding and page breaks
    ... but I still have one nagging formatting problem. ... each entry in table1. ... simply pulls the first match in table2 instead of showing all the ... Otherwise I was thinking along the lines of your 2nd suggestion of using some calcs to consolidate the data down to a smaller number of tables used in the layout. ...
    (comp.databases.filemaker)