Update multiple rows with one query?

Codes here !

Moderators: macek, egami, gesf

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

Update multiple rows with one query?

Postby Tony121076 » 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.

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

Postby Ace » 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 :)

Ace

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

Postby Elena Mitovska » Fri Feb 14, 2003 3:35 am

Yes, you just need to use something like that:

update my_table set column_date=CURRENT_DATE();


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 2 guests