
October 31st, 2003, 08:14 AM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 67
Time spent in forums: 50 m 57 sec
Reputation Power: 5
|
|
|
Help with query (easy for experieced) needed.
HI, all.
I am having a bad time figuring out a good query for what I want. Wich is, to obtain the JUST (one) the latest instance (from the date-type field) for each proveedor_id (provider). As a result I just need proveedor_id, orden_fecha. In plain eglish, it is the last time an order was placed to each provider.
I have already tried a reasonable amount of time  .
Please help... here´s the table structure:
Code:
CREATE TABLE `ordenes` (
`orden_id` int(3) NOT NULL auto_increment,
`orden_nombre` varchar(25) NOT NULL default '',
`orden_fecha` date NOT NULL default '0000-00-00',
`orden_comentario_texto` text NOT NULL,
`proveedor_id` int(3) NOT NULL default '0',
`status_orden_id` int(4) default '1',
PRIMARY KEY (`orden_id`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;
Thanks in advance.
__________________
..:: Ignorance is *really* bliss (trust me)::..
|