带点(。)的Mysql ORDER BY

时间:2013-11-20 06:45:42

标签: mysql

我在教程中看到了这段代码。但我不知道a和b之间的。()点的目的是什么。请有人解释一下。

ORDER BY `a`.`b` DESC LIMIT 1

代码如下

SELECT * 
FROM pop_outlog 
ORDER BY pop_outlog.time_sent DESC 
LIMIT 1;

这样做的目的是什么,而不是只使用列名?

1 个答案:

答案 0 :(得分:2)

基本问题。

ORDER BY `table_name`.`column_name` DESC LIMIT 1

它可以在任何if列允许的地方使用。像这样

SELECT t1.col1, t2.col2
FROM t1, t2
WHERE t1.col1 = t2.col2
ORDER BY t1.col1
GROUPY BY t2.col2