(mysqli):
SELECT SQL_CALC_FOUND_ROWS
nodes.*,
DATE_FORMAT( nodes.CreationDate, '%Y. %M %e. %H:%i' ) AS CreationDate,
DATE_FORMAT( nodes.StartDate, '%Y. %M %e.' ) AS StartDate,
IFNULL( nodes.StartDate, nodes.CreationDate ) AS pubDate,
img.Id AS ImgId,
CONCAT( '/attachment/', IF( img.DirectoryPath IS NULL, '', CONCAT( img.DirectoryPath, '/' ) ), img.Id, '_', img.FileName ) AS ImgPath,
img.Name AS ImgName,
node_types.StrId AS TypeStrId,
node_types.Detail AS DetailStrId,
users.Id AS OwnerId,
users.Name AS OwnerName
FROM
node_types,
nodes
LEFT JOIN
users ON
nodes.CreationUserId = users.Id
AND
users.Deleted IS NULL
LEFT JOIN node_image ON node_image.NodeId = nodes.Id
LEFT JOIN attachments AS img ON img.ParentId = node_image.AttachmentId AND img.CopyId = 1
WHERE
node_types.Id = 24
AND
node_types.Id = nodes.TypeId
AND
nodes.Deleted IS NULL
AND
( nodes.StartDate IS NULL OR nodes.StartDate <= NOW() )
AND
( nodes.EndDate IS NULL OR nodes.EndDate > NOW() )
AND
nodes.Public IS NOT NULL
GROUP BY
nodes.Id
ORDER BY
pubDate DESC
LIMIT 10
OFFSET 0
(mysqli): SELECT FOUND_ROWS()