You are here: Re: Need expert assistance with this (MySQL routine) « All PHP « IT news, forums, messages
Re: Need expert assistance with this (MySQL routine)

Posted by scott Johnson on 10/13/36 11:30

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@gmail.com 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация