Update multiple rows with one query?

Codes here !

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm

Fri Feb 07, 2003 3:32 pm

I need to update the date columb in every row to the reflect the current date. I know how to do the date :) but how do I update every row at once? Can I just leave out the WHERE ?

I know I should try this before posting a question here, but I'm new to this, and it will take me forever to set up another database to test this. Thank you for your time and attention.

New php-forum User
New php-forum User
Posts: 9
Joined: Sun Oct 27, 2002 7:28 am

Sun Feb 09, 2003 11:38 am

Or, u can do as I do mostly now...

CREATE TABLE new_temptable SELECT * FROM `org_table`

And u have a copy of a table u can mess with :)


Elena Mitovska
New php-forum User
New php-forum User
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Fri Feb 14, 2003 3:35 am

Yes, you just need to use something like that:

update my_table set column_date=CURRENT_DATE();
best regards,
Elena Mitovska,
AlarIt company

Post Reply