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
| Thread |
|---|
| • GROUP BY - INNER JOIN and LIMIT - how to get result | Arkadiusz Malka | 29 Nov |