Michael Stassen" <[EMAIL PROTECTED]>
To: "fgmmoribe" <[EMAIL PROTECTED]>
Cc: "mysql" <[EMAIL PROTECTED]>
Sent: Tuesday, July 27, 2004 7:11 AM
Subject: Re: select in Mysql 4.0
fgmmoribe wrote:
I have a table like this
+-+---+---
To get the one record with the MAX() value in a field, I would do:
SELECT @maxcod:=max(cod) from #temp;
SELECT * from #temp where cod = @maxcod;
To get all of the records with the max(cod) value for each idtable value,
I would use a temp table:
create temporary table tmpMax
SELECT idtable, max(
IL PROTECTED]>
Sent: Tuesday, July 27, 2004 7:11 AM
Subject: Re: select in Mysql 4.0
>
> fgmmoribe wrote:
> > I have a table like this
> >
> >
+-+---+--+-+-+--
fgmmoribe wrote:
I have a table like this
+-+---+--+-+-++
| Field | Type | Null | Key | Default | Extra |
+-+---+--+-+-++
| id | int(3)
I have a table like this
+---+-+--+-+-++
| Field | Type | Null | Key | Default | Extra |
+---+-+--+-+-++
| id | int(3) | | PRI | NULL |
auto_increment |
| idTable | int(3) unsig