You are here: moving data after it has been inserted so many times « PHP SQL « IT news, forums, messages
moving data after it has been inserted so many times

Posted by Shattered_Mynd on 10/14/67 11:32

I'm building an app in PHP MySQL and am trying to think of the best way to
implement this:

The problem is I want to collect data entered into a form when 3 of these
entries match I want to move ONE instance of it to another table. The idea
I've had is to construct a count query like this:

SELECT
table1.Name,
COUNT(Name) AS NumOccurrences
FROM
table1
GROUP BY
table1.Name
HAVING
(COUNT(Name) > 2)

The result form this query shows all of the entries that have been inserted
into the table more than three times.

My Question is how can I take this result and put it into another table
(i.e. table2) and delete all instances of it in table1? This should happen
only if this query puts out a result? If not (so if there are less than two
matching entries in the table) then the Name is added into table1 as
normal.

Any help or assistance you guys can give me with this will be highly
appreciated.

TIA

 

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

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