Re: [PHP] Update identical table

2002-09-29 Thread Justin French

on 30/09/02 8:09 AM, David Freeman ([EMAIL PROTECTED]) wrote:

> What about getting rid of "tmp_data" completely and adding an extra
> column to your "data" table.  The extra column, say "approved" would act
> as a flag that, if set (ie. "= 1") means that the data is confirmed and,
> if not set, means the data is not confirmed.
> 
> Using this, you could use the setting in your "approved" column in
> queries to find data that you've not yet confirmed or whatever.  Saves
> the whole mess of reading in data from one table to write to another
> table and also avoids the potential for errors if you change your
> database structure at all (and forget to make the change in both
> tables).

totally agree

Justin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Update identical table

2002-09-29 Thread David Freeman


 > I have 2 identical tables called "tmp_data" and "data". (on 
 > the same mysql database).
 > What would be the simple and more convenient way to update 
 > table "data" with a row from table "tmp_data".

What about getting rid of "tmp_data" completely and adding an extra
column to your "data" table.  The extra column, say "approved" would act
as a flag that, if set (ie. "= 1") means that the data is confirmed and,
if not set, means the data is not confirmed.

Using this, you could use the setting in your "approved" column in
queries to find data that you've not yet confirmed or whatever.  Saves
the whole mess of reading in data from one table to write to another
table and also avoids the potential for errors if you change your
database structure at all (and forget to make the change in both
tables).

CYA, Dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Update identical table

2002-09-28 Thread John W. Holmes

> I have 2 identical tables called "tmp_data" and "data". (on the same
mysql
> database).
> What would be the simple and more convenient way to update table
"data"
> with a row from table "tmp_data".
> (something like select * from tmp_data and than update data ...).

Why not have just one table with a flag that says whether it's a temp
row or not?? It would make things easier and not replicate data.

If you don't want to do that, use the INSERT INTO table2 SELECT ... FROM
table1 WHERE ...

---John Holmes...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Update identical table

2002-09-28 Thread Marek Kilimajer

INSERT INTO data SELECT * FROM tmp_data WHERE condition_definition

Radu Manole wrote:

>Hi guys,
>
>I have 2 identical tables called "tmp_data" and "data". (on the same mysql database).
>What would be the simple and more convenient way to update table "data" with a row 
>from table "tmp_data".
>(something like select * from tmp_data and than update data ...).
>
>Thanks a lot,
>Radu
>
>  
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php