Reply to Re: using fields from two tables - mysql

Your name:

Reply:


Posted by Sean on 12/07/06 10:11

"Gaga" <rg2006@hotmail.com> wrote in message
news:el6o5e$qis$1@ss408.t-com.hr...
>> If I understand you correctly you have two tables "users" and "data". If
> you
>> have the userid as the primary key in the users, you can use that id as a
>> secondary key in your data table. That way you can build a relationship
> between
>> the two tables and can group the information correctly in your SQL.
>
> -- I dont know how to make this in mysql :-(
>
> Im reading data from one table. After i have read selected data i want to
> write this data into second table and delete old data in the first table.
> I
> want to make simple "data move" from first to second table. I need to make
> all this on one php page. How ?
>
>
>

You should be able to do this in two steps. This is very basic and if you
are going to guarantee the validity of the transfer you would need to do
some more validation to ensure that noone (or nothing) adds a record to
table1 between these two commands.

insert table2 (field1, field2, field3)
values select field1, field2, field3 from table1 where field3 = 'criteria'

delete * from table1 where field3 = 'criteria'

Sean

[Back to original 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

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