Re: using max() on update

2004-07-28 Thread SGreen
d.dateposted set status = 1; > ERROR 1052: Column: 'status' in field list is ambiguous > mysql> > > > > ----- Original Message ----- > From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Date: Tue, 27 Jul 2004 09:17:44 -0400 > Subject: Re: using max() on update > To:

Re: using max() on update

2004-07-27 Thread Louie Miranda
in field list is ambiguous mysql> - Original Message - From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Tue, 27 Jul 2004 09:17:44 -0400 Subject: Re: using max() on update To: Louie Miranda <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Here's how I handle these situations.

Re: using max() on update

2004-07-27 Thread SGreen
Here's how I handle these situations. If I need all of the data from the row that contains the maximum of an unindexed column: SELECT @maxval := MAX(column_name) FROM tablename; SELECT * FROM tablename WHERE column_name = @maxval; For the same thing but for an indexed column SELECT * FROM table