Re: UPDATE question

2006-05-03 Thread Terry Burton

On 5/3/06, Barry [EMAIL PROTECTED] wrote:

Cummings, Shawn (GNAPs) schrieb:

 If I have 4 Fields (FIELD1, FIELD2, FIELD3  FIELD4)

 I can do this easily;

 UPDATE TABLE_NAME SET FIELD4 = FIELD1;

 But -- how do I do it so that FIELD4 = FIELD1  FIELD2 ???  I can't seem
 to find any examples online.  Maybe it's just too early in the morning -
 I'm drawing a blank! ;)

FIELD4 = FIELD1  FIELD 2?

Field 4 should be field 1 AND field 2?

Can't decide which one field4 should get? :P


Well, every child learns that 1 and 1 is 2 ;-P

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to select the last entry per item

2006-04-27 Thread Terry Burton
On 4/27/06, Brian J. Matt [EMAIL PROTECTED] wrote:
 As the items move new time stamped entries are added to the
 database.  How would you query to find the current location of all
 the items currently in the system.  As you might expect we don't want
 to replace the entry for an item when a location update is made
 because we need to keep the history.  We plan on removing items after
 a suitable delay when they reach their destination.

If you are looking to obtain a result set the represents the current
location of all items in the system you can use a sub-select as
follows:

SELECT item_id AS lid,location,status,timestamp
FROM xyz
WHERE timestamp=(
SELECT MAX(timestamp) FROM xyz WHERE item_id=lid
)

For the sake of efficiency make sure you have a key on timestamp.


Hope this helps,

Tez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: mySQL Backups

2006-04-12 Thread Terry Burton
On 4/12/06, Tim Lucia [EMAIL PROTECTED] wrote:
 Would you not lock tables on the slave?  The idea of catching it up implies
 this is way it is done.  Catching up means once replication can proceed once
 the tables are unlocked (on the slave).

 At least that is the way I read it...

On the slave I perform a slave stop, (optional) lock tables,
mysqldump, slave start. Since the slave is a dedicated backup
instance, and is never connected to directly by applications, the
backup is entirely transparent to database users. My suggestion is for
the purpose of simplifying such a setup such that it can be performed
from a single MySQL instance.


Tez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



mySQL Backups

2006-04-11 Thread Terry Burton
On 4/11/06, Dana Diederich [EMAIL PROTECTED] wrote:
 We use a dedicated replicated instance for backups.

 Every night, we lock all of the tables, and dump all of them to
 compressed files, and unlock them afterwards.  It takes a while to catch
 up, but that doesn't hurt anything.

I too use this solution, but it occurs to me that it would be useful
if it were possible to replicate one database into another
(differently named) database on the same mysql instance for the very
purpose of taking snapshots without locking tables in the live system.

I realise that it is possible to do this by running two local mysql
instances, but a local replicator could be an interesting interim
backup solution. Might something like this be on the agenda, or would
the planned holistic backup solution eclipse such a feature.


Thanks,

Tez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



CREATE TABLE x AS with ENGINE = ARCHIVE

2006-03-28 Thread Terry Burton
Hi,

I'm using MySQL 4.11. Is it possible to use the CREATE TABLE x AS
syntax alongside the ENGINE = x pragma, since this would make
archiving of tables very simple.

I require something along the lines of this:

CREATE TABLE old AS SELECT * FROM request_log ENGINE=ARCHIVE

If this cannot be done then I can always get equivalent functionality
by performing CREATE TABLE x (...) ENGINE=x followed by INSERT INTO x
SELECT * FROM x, however this is not so neat since it require
knowledge of the source table structure which makes it less ideal for
automation.


Many thanks,

Tez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: CREATE TABLE x AS with ENGINE = ARCHIVE

2006-03-28 Thread Terry Burton
On 3/28/06, Pure Web Solution [EMAIL PROTECTED] wrote:
 I dont think that it is possible to specify the engine when creating a table
 this way, you could however create the table using the:

 CREATE TABLE old AS SELECT * FROM request_log

 and then issue an alter table command setting the engine to whatever you like.

Thanks Paul,

That solution seems a little wasteful in terms of resources though.

If there is no nice way to achieve this operation then do people think
that it would be a good idea to push for the inclusion of this
functionality.

If more folks than myself can see the benefit in this then please
speak up, in which can I'll cross post this to the development list to
see what the devs make of it.


Warm regards,

Tez

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: CREATE TABLE x AS with ENGINE = ARCHIVE

2006-03-28 Thread Terry Burton
On 3/28/06, Peter Brawley [EMAIL PROTECTED] wrote:
 I require something along the lines of this:

 CREATE TABLE old AS SELECT * FROM request_log ENGINE=ARCHIVE

 CREATE TABLE tblname ENGINE=archive SELECT * FROM request_log;

 PB

Excellent. Exactly what I need. Thanks :-)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]