Re: [PHP-DB] Help With An UPDATE Query Please

2004-02-10 Thread Ignatius Reilly
UPDATE table
SET column = CONCAT(
MID( column, 2, LENGTH( column ) - 1 ),
MID( column, 1, 1 )
)
WHERE column LIKE 'M%'

HTH
Ignatius
_
- Original Message -
From: "Shaun" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 10, 2004 14:15
Subject: [PHP-DB] Help With An UPDATE Query Please


> Hi,
>
> How can I update a column where the first letter begins with 'M' and
adjust
> it so that column ends with 'M' instead. So something like 'UPDATE table
SET
> column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am
trying
> to achieve!
>
> Thanks
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP-DB] Help With An UPDATE Query Please

2004-02-10 Thread Shaun
Hi,

How can I update a column where the first letter begins with 'M' and adjust
it so that column ends with 'M' instead. So something like 'UPDATE table SET
column = 'xxxM' WHERE column = 'Mxxx'. I hope this explains what I am trying
to achieve!

Thanks

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



Re: [PHP-DB] Help with an UPDATE query please

2004-02-05 Thread John W. Holmes
> > I have (among others) two DATE columns in a table; Booking_Date and
> > Booking_Completion_Date. How can I run a query that updates
> > Booking_Completion_Date to be 2 days after Booking_Date where
> > Booking_Completion_Date is NULL?

UPDATE table SET Booking_Completion_Date = Booking_Date + INTERVAL 2 DAY
WHERE Booking_Completion_Date IS NULL;

---John Holmes...

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



[Fwd: Re: [PHP-DB] Help with an UPDATE query please]

2004-02-05 Thread Stuart Gilbert
[Forwarded for Paxson Jr. because this was only sent to me.]

you can also easily use the mysql date functions

http://www.mysql.com/doc/en/Date_and_time_functions.html

On 05. Feb 2004, at 11:23 Uhr, Stuart Gilbert wrote:

Presuming you have the date in your PHP code you could simply add 
172800 (seconds in 2 days) to the current value and insert it in the 
same way as you are doing with your current dates.

If you post how you're inserting your dates, what format you're using 
and stuff like that then you'll probably get more concise help.

Shaun wrote:
Hi,
I have (among others) two DATE columns in a table; Booking_Date and
Booking_Completion_Date. How can I run a query that updates
Booking_Completion_Date to be 2 days after Booking_Date where
Booking_Completion_Date is NULL?
Many thanks
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with an UPDATE query please

2004-02-05 Thread Stuart Gilbert
Presuming you have the date in your PHP code you could simply add 172800 
(seconds in 2 days) to the current value and insert it in the same way 
as you are doing with your current dates.

If you post how you're inserting your dates, what format you're using 
and stuff like that then you'll probably get more concise help.

Shaun wrote:
Hi,

I have (among others) two DATE columns in a table; Booking_Date and
Booking_Completion_Date. How can I run a query that updates
Booking_Completion_Date to be 2 days after Booking_Date where
Booking_Completion_Date is NULL?
Many thanks

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


[PHP-DB] Help with an UPDATE query please

2004-02-05 Thread Shaun
Hi,

I have (among others) two DATE columns in a table; Booking_Date and
Booking_Completion_Date. How can I run a query that updates
Booking_Completion_Date to be 2 days after Booking_Date where
Booking_Completion_Date is NULL?

Many thanks

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