GROUP BY - INNER JOIN and LIMIT - how to get result

------=_NextPart_000_007F_01CB8FB1.765BEB70
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

I have tables:



CREATE TABLE `tblNames` (

` IdName` int(11) NOT NULL AUTO_INCREMENT,

`Name` varchar(60) DEFAULT NULL,

PRIMARY KEY (`IdName`),

) ENGINE=MyISAM





CREATE TABLE `tblStatusy` (

`IdStatus` int(11) NOT NULL AUTO_INCREMENT,

`IdName` int(11) DEFAULT NULL,

`Status` varchar(60) DEFAULT NULL,

`Data` datetime DEFAULT NULL,

PRIMARY KEY (`IdStatus`),

KEY `ixIDName` (`IdName `)

) ENGINE=MyISAM



How to get result which will be look like this:

tblNames.Id, tblNames.Name, (subquery which will return tblStatusy.Status,
tblStatusy.Data ordered by Data DESC LIMIT 1), (subquery which will return
tblStatusy.Status, tblStatusy.Data ordered by Data DESC LIMIT 1,1),
(subquery which will return tblStatusy.Status, tblStatusy.Data ordered by
Data DESC LIMIT 2,1)



Any idea how to get this?



Best regards


------=_NextPart_000_007F_01CB8FB1.765BEB70--
Arkadiusz Malka [ Mo, 29 November 2010 10:37 ] [ ID #2050943 ]
Datenbanken » gmane.comp.db.mysql.general » GROUP BY - INNER JOIN and LIMIT - how to get result

Vorheriges Thema: mysql_upgrade fails with "Access denied"
Nächstes Thema: Uprading of MySQL