选择SQL中的第二个最后一条记录

时间:2015-07-13 10:39:39

标签: mysql sql mysql-error-1064

我需要使用Google专栏获取DATE的第二个最后记录,但这是不可能的,因为查询非常复杂。

我试过" -1"任何一条查询都没有

SELECT d.dominio AS dominio_dominio,
    p.palavra AS palavras_palavra,
    rm.posicao_google AS google,
    rm.verificado AS verificao_robo,
    rm.usuario AS rank_dono,
p.id AS id_palavra
FROM rank_monitor rm
JOIN dominio d ON d.id = rm.dominio
JOIN palavras p ON p.id = rm.palavras
LEFT JOIN rank_monitor rm1 ON rm1.dominio = rm.dominio
    AND rm1.palavras = rm.palavras
    AND rm1.verificado > rm.verificado
WHERE rm1.id IS NULL
    AND rm.usuario = '35'
GROUP BY rm.palavras-1
ORDER BY rm.posicao_google ASC

我如何提供谷歌专栏的第二个结果?

我看到问题Select the SECOND LAST record in each group但未解决。

0 个答案:

没有答案