[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-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-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



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


[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 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



[PHP-DB] Help With Another UPDATE Query Please!

2003-10-04 Thread Shaun
Hi,

I am making some alterations to my Database. I have a table called projects
and a table called Work_Types. Projects currently contains the name of the
work type (Work_Type) but now I want to change this so it contains the
Work_Type_ID, is it possible to update Projects with one query?

Thanks for your help

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



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

2003-10-04 Thread Jeff Shapiro

It all depends on what database server (and version) you are using. I'm 
not really sure what you are asking, and could use a little more detail 
about the tables and what are needing to do. 

On Sat, 4 Oct 2003 13:45:56 +0100, Shaun spoke thusly about [PHP-DB] 
Help With Another UPDATE Query Please!:
 Hi,
 
 I am making some alterations to my Database. I have a table called projects
 and a table called Work_Types. Projects currently contains the name of the
 work type (Work_Type) but now I want to change this so it contains the
 Work_Type_ID, is it possible to update Projects with one query?
 
 Thanks for your help

---
Listserv only address.
Jeff Shapiro

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



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

2003-10-04 Thread Shaun
I am using mySQL 3.23

Each project has a work type associated with it, currently the Work Type
column of the Project table holds the work type name, however i have now
added a Work_Type_ID column to the Work_Type table and i would like Projects
to hold the Work_Type_ID as opposed to the Work Type Name.

Thanks for your help

Jeff Shapiro [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 It all depends on what database server (and version) you are using. I'm
 not really sure what you are asking, and could use a little more detail
 about the tables and what are needing to do.

 On Sat, 4 Oct 2003 13:45:56 +0100, Shaun spoke thusly about [PHP-DB]
 Help With Another UPDATE Query Please!:
  Hi,
 
  I am making some alterations to my Database. I have a table called
projects
  and a table called Work_Types. Projects currently contains the name of
the
  work type (Work_Type) but now I want to change this so it contains the
  Work_Type_ID, is it possible to update Projects with one query?
 
  Thanks for your help

 ---
 Listserv only address.
 Jeff Shapiro

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