Thanks for the info. I am using 4.0.24, so maybe this is the problem.
I was able to get around this by first checking if the mac field was
empty, but I will look into upgrading mysql to a more current version.
thanks
----- Original Message -----
From: [EMAIL PROTECTED]
Date: Monday, April 25, 2005 9:26 am
Subject: Re: problem with update statement
> Hi,
> this is an example where what you describe doesn't happen (v 4.1
> and 5.0) :
> mysql> create table ports(mac varchar(17),port_index varchar(3));
> Query OK, 0 rows affected (0.10 sec)
>
> mysql> insert into ports
> values('00:04:FB:23:5A:44','120'),(NULL,'120');Query OK, 2 rows
> affected (0.08 sec)
> Records: 2 Duplicates: 0 Warnings: 0
>
> mysql> select * from ports;
> +-------------------+------------+
> | mac | port_index |
> +-------------------+------------+
> | 00:04:FB:23:5A:44 | 120 |
> | NULL | 120 |
> +-------------------+------------+
> 2 rows in set (0.00 sec)
>
> mysql> select * from ports where mac='00:04:FB:23:5A:44';
> +-------------------+------------+
> | mac | port_index |
> +-------------------+------------+
> | 00:04:FB:23:5A:44 | 120 |
> +-------------------+------------+
> 1 row in set (0.00 sec)
>
> mysql>
> mysql> update ports set port_index='123' where
> mac='00:04:FB:23:5A:44';Query OK, 1 row affected (0.41 sec)
> Rows matched: 1 Changed: 1 Warnings: 0
>
> mysql> select * from ports;
> +-------------------+------------+
> | mac | port_index |
> +-------------------+------------+
> | 00:04:FB:23:5A:44 | 123 |
> | NULL | 120 |
> +-------------------+------------+
> 2 rows in set (0.00 sec)
>
> mysql>
>
> if you use an old version which is buggy, just migrate.
>
> Mathias
>
> Selon Brent Baisley <[EMAIL PROTECTED]>:
>
> > That is very odd behavior and shouldn't be happening. I ran a quick
> > test on my machine and MySQL does not exhibit that behavior. You
may
> > try running and repair on your table. Perhaps something is out of
> > whack. What version of MySQL are you running?
> >
> >
> > On Apr 22, 2005, at 6:08 PM, [EMAIL PROTECTED] wrote:
> >
> > > Hello, all:
> > >
> > > In a MyISAM table, I have a column named "MAC", of type
> VARCHAR(17).> > This field is used to hold MAC addresses of
> computers' network
> > > interface cards. These MAC addresses are in the
> > > form "XX:XX:XX:XX:XX:XX", where X can be either a number or an
> > > uppercase letter. I can run "select * from table where
> > > MAC='00:04:FB:23:5A:44'" and the correct record is returned.
> However,> > performing "update table set port_index='123' where
> > > MAC='00:04:FB:23:5A:44'" does not work as I expected. It does
> update> > the correct record, but also updates all other records
> whose MAC field
> > > is empty. When I originally created this field, I used type
> VARCHAR> > (17), null, default value NULL. In troubleshooting
> this, I have since
> > > change the type to CHAR(17), not null, empty default value.
Still
> > > have the same problem. Does anyone know what's going on here,
> and how
> > > I could correct this?
> > >
> > > Thanks!
> > >
> > > --
> > > MySQL General Mailing List
> > > For list archives: http://lists.mysql.com/mysql
> > > To unsubscribe:
> > > http://lists.mysql.com/[EMAIL PROTECTED]
> > >
> > >
> > --
> > Brent Baisley
> > Systems Architect
> > Landover Associates, Inc.
> > Search & Advisory Services for Advanced Technology Environments
> > p: 212.759.6400/800.759.0577
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]>
> >
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]