On Mon, Jul 21, 2008 at 2:43 PM, mos <[EMAIL PROTECTED]> wrote:
> I thought if MySQL found a duplicate key on the insert, it would
> automatically update the existing row that it found with the results from
> table1 if I left out the column expressions in the update clause. But
> apparently it doe
At 12:16 PM 7/21/2008, you wrote:
So just use REPLACE instead of INSERT...
Sure, but a Replace will delete the existing row and insert the new one
which means also maintaining the indexes. This will take much longer than
just updating the existing row. Now if there were only a couple of ro
So just use REPLACE instead of INSERT...
http://dev.mysql.com/doc/refman/5.0/en/replace.html
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> At 08:23 PM 7/20/2008, Perrin Harkins wrote:
>
>> On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
>> > Is there a way t
At 11:00 AM 7/21/2008, Perrin Harkins wrote:
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> I can't specify all of the columns in a Set statement in the
> OnDuplicate clause because I don't know what the column names are and there
> could be 100 columns.
Write code to d
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> I can't specify all of the columns in a Set statement in the
> OnDuplicate clause because I don't know what the column names are and there
> could be 100 columns.
Write code to do it. There is no way around specifying the co
At 08:23 PM 7/20/2008, Perrin Harkins wrote:
On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
> Is there a way to get "Insert ... select ... On Duplicate Update" to
update
> the row with the duplicate key?
That's what it does.
> Why can't it do this?
What makes you think it
On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
> Is there a way to get "Insert ... select ... On Duplicate Update" to update
> the row with the duplicate key?
That's what it does.
> Why can't it do this?
What makes you think it can't?
- Perrin
--
MySQL General Mailing List
Is there a way to get "Insert ... select ... On Duplicate Update" to
update the row with the duplicate key? Otherwise I'll have to use Replace
which is inefficient because it deletes the old duplicated row and then
inserts the new row with the same key. I'd much rather have it update the
exist