On Mon, 2005-10-03 at 23:26 -0400, Jim Mullen wrote:
> Try the syntax:
> 
>     UPDATE tablename SET columnname = value
> 
> Since there is no "WHERE" clause, this will affect every record in the 
> table. A simple example (since I'm not familiar with the INTERVAL 
> function) of updating a INT column called Score to add "2" to every 
> record in table Football would look like:

OK, I think I need to better explain what I am doing. First, I have
several tables with records stored in them with a submit date/time field
that is the field type datetime. All the fields as stored in the Eastern
Time Zone, GMT -5, (where the server is located), generated by the now()
MySQL function. My client wants all the times and dates to be in the
Mountain time zone, GMT -7.

I found the INTERVAL function in MySQL that would allow me to change the
time in a SELECT statement. That would allow me to do the following:

SELECT submit_id, submit_time, (submit_time - INTERVAL 2 HOUR) as
new_submit_time FROM submits.

and get the corrected time. Then, in PHP, I could then traverse through
all the records, in a while loop or something else, and use an UPDATE
statement to update all the records from the old submit time to the new
submit time.

I was wondering if it was possible to do this with one SQL statement
(for each table) in phpmyadmin, so I don't have to write up the php
pages to parse each table.

Does that better explain what I am wanting to do?
--
Doug

Registered Linux User #285548 (http://counter.li.org)
----------------------------------------
Random Thought:
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/CefplB/TM
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to