Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Update multiple rows with one query?

Codes here !

Moderators: macek, egami, gesf

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.
Tony121076
New php-forum User
New php-forum User
 
Posts: 28
Joined: Fri Jan 03, 2003 4:00 pm

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
Ace
New php-forum User
New php-forum User
 
Posts: 9
Joined: Sun Oct 27, 2002 7:28 am

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();
Elena Mitovska
New php-forum User
New php-forum User
 
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.