Re: giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
i agree with the logic that mysql treats things as sets. my problem can easily be solved by treating one row at a time. thanks again! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Next MySQL Magazine --call for articles

2007-07-11 Thread B. Keith Murphy
Hey everyone, I am starting to prepare for the second issue of MySQL Magazine. I am planning on putting it out on September 1. Thanks for the fabulous response to the first issue!! There was over a 1,000 downloads of the magazine. That is just fabulous!!! Special thanks to those who contribute

Re: starting a second slave from a first slave's dump

2007-07-11 Thread Ofer Inbar
Baron Schwartz <[EMAIL PROTECTED]> wrote: > Ofer Inbar wrote: > > host a is the master > > host b is a replication slave > > host c is to become a second replication slave > > there's no full dump from host a > >One possibility I can think of: > > - stop slave on host b > > - run the dump on h

Re: starting a second slave from a first slave's dump

2007-07-11 Thread Baron Schwartz
Hi Ofer Inbar wrote: Scenario: host a is the master host b is a replication slave host c is to become a second replication slave there's no full dump from host a [snip] One possibility I can think of: - stop slave on host b - run the dump on host b - note its position in host a's bi

starting a second slave from a first slave's dump

2007-07-11 Thread Ofer Inbar
Scenario: host a is the master host b is a replication slave host c is to become a second replication slave there's no full dump from host a Normally, to start a new slave, I'd restore a dump from host a, and start slaving using the master data in that dump. In this situation, however, ru

Re: giving a row the new highest id

2007-07-11 Thread Baron Schwartz
Olav Mørkrid wrote: wait, let's make it even more interesting :) what if you want to update more than one row, and each row should have a successive new id. is that possible in one statement? i tried just removing the where statement in barons suggestion, which fails as i guess the select is co

Re: BUG in UNION implementation?! Confimation or Explaination please

2007-07-11 Thread Joshua J. Kugler
On Wednesday 11 July 2007 00:34, Anders Karlsson wrote: > UNION will only return distinct rows. This is according to spec and to > the SQL Standard. And of course, to no one's surprise, this also matches the mathematical definition of union: j -- Joshua Kugler Lead

Re: giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
wait, let's make it even more interesting :) what if you want to update more than one row, and each row should have a successive new id. is that possible in one statement? i tried just removing the where statement in barons suggestion, which fails as i guess the select is computed only once prio

Re: giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
baron your suggestion does the trick indeed. i take a deep bow! thanks also for mentioning the related issues. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: giving a row the new highest id

2007-07-11 Thread Baron Schwartz
Hi, Olav Mørkrid wrote: mysql> update test set id = (select max(id) + 1 from test) where id = '$myid'; ERROR 1093 (HY000): You can't specify target table 'test' for update in FROM clause You will need to place the subquery in another subquery in the FROM clause so it is materialized to a tem

Re: giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
what i want to do is to take an old row from maybe three weeks ago, and make its id appear as if it was the newest inserted row in the table. therefore last_insert_id() cannot be used. i could introduce a timestamp column to achieve my goals, but for certain reasons i would like to update the id

Re: giving a row the new highest id

2007-07-11 Thread Olexandr Melnyk
2007/7/11, Olav Mørkrid <[EMAIL PROTECTED]>: thanks olexandr my posting had a misprint. the select should be on "mytable" not "user", so when i use your suggestion, i get an error: mysql> update test set id = (select max(id) + 1 from test) where id = '$myid'; ERROR 1093 (HY000): You can't spec

Re: giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
thanks olexandr my posting had a misprint. the select should be on "mytable" not "user", so when i use your suggestion, i get an error: mysql> update test set id = (select max(id) + 1 from test) where id = '$myid'; ERROR 1093 (HY000): You can't specify target table 'test' for update in FROM clau

Re: How to restore 1 database from mysqldump of all databases

2007-07-11 Thread waldo_tumanut
Thanks to all who have replied. Since this thread has evolved into discussing the dump, I would like to ask the group what are their practices for backup and recovery on Windows platform. Waldo Tumanut Database Analyst

Re: giving a row the new highest id

2007-07-11 Thread Olexandr Melnyk
Err.. you can do this: update table mytable set id = (select max(id) + 1 from user) where id = $oldid but I would recommend to use a transaction 2007/7/11, Olexandr Melnyk <[EMAIL PROTECTED]>: update table mytable set id =last_insert_id() + 1 where id = $oldid 2007/7/11, Olav Mørkrid <[EMAI

Re: giving a row the new highest id

2007-07-11 Thread Olexandr Melnyk
update table mytable set id =last_insert_id() + 1 where id = $oldid 2007/7/11, Olav Mørkrid <[EMAIL PROTECTED]>: using one single sql statement, how do i update the auto_increment id column of a row to have the new highest id in the table? in other words: how do i make a row seem like it was j

giving a row the new highest id

2007-07-11 Thread Olav Mørkrid
using one single sql statement, how do i update the auto_increment id column of a row to have the new highest id in the table? in other words: how do i make a row seem like it was just inserted? i know how to do it with two statements, but i want to do it with one to ensure nothing goes wrong:

Re: how to stop replication at a specific position?

2007-07-11 Thread Baron Schwartz
Use START SLAVE UNTIL. There are two syntaxes -- check the manual. Ofer Inbar wrote: When you start a replication slave you can tell it where in the binary logs to start (which log file, what position) ... but can you tell it to automatically *stop* when it reaches a certain point (also identif

Re: load data

2007-07-11 Thread Ananda Kumar
Hi Campbell, I tried this LOAD DATA LOCAL INFILE 'abc.txt' INTO TABLE abc FIELDS TERMINATED BY ',' LINES TERMINATED BY '^V\n' (date_format(doj,'%d-%M-%Y %H:%i:%S'); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ri

RE: load data

2007-07-11 Thread Rhys Campbell
Can you not change your proceedure and format your dates first using DAT_FORMAT()? http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function _date-format You could put a trigger on the table that would format the dates before insert (although I'd go for the above) -Original

RE: BUG in UNION implementation?! Confimation or Explaination please

2007-07-11 Thread Rhys Campbell
UNION is mean to removed duplicate rows. Use "UNION ALL" if you don't want this to happen. http://dev.mysql.com/doc/refman/5.0/en/union.html -Original Message- From: list account [mailto:[EMAIL PROTECTED] Sent: 11 July 2007 09:19 To: mysql@lists.mysql.com Subject: BUG in UNION implementat

Re: BUG in UNION implementation?! Confimation or Explaination please

2007-07-11 Thread Anders Karlsson
UNION will only return distinct rows. This is according to spec and to the SQL Standard. To avoid this, use UNION ALL instead of UNION. Try that with your queries and you'll see that this will do the trick. This is, as I said, in accordance with the standard and the way all SQL based databases

BUG in UNION implementation?! Confimation or Explaination please

2007-07-11 Thread list account
Hi all, I believe to have found a bug in MySQL's union implementation. Can someone confirm this, please or convince me that this is not a buggy behaviour of mysql : UNION seems to behave like DISTINCT by default: mysql> select 2 c1 -> union -> select 1 c1 -> union -> select 2 c1 -

how to stop replication at a specific position?

2007-07-11 Thread Ofer Inbar
When you start a replication slave you can tell it where in the binary logs to start (which log file, what position) ... but can you tell it to automatically *stop* when it reaches a certain point (also identified by log file name and position) ? -- Cos -- MySQL General Mailing List For list ar

Mac OS X PowerPC 64 bit

2007-07-11 Thread Jan Pieter Kunst
Dear mysql-ers, It seems that the Mac OS X PowerPC 64 bit version of the MySQL Community server is no longer available. Now I'm wondering which version I should use on a G5 PowerMac. PowerPC 32 bit or Universal? Thanks for any insights. Jan Pieter Kunst -- MySQL General Mailing List For list