select author_id AS id from Views group by author_id order by author_id ASC where author_id = viewer_id
时间: 2024-03-19 20:45:50 浏览: 121
Like-and-OrderBy.rar_sql like order by
在 SQL 查询中,`SELECT` 子句应该在 `FROM` 子句之前,`WHERE` 子句应该在 `GROUP BY` 和 `ORDER BY` 子句之后。因此,正确的查询语句应该是这样的:
```
SELECT author_id AS id
FROM Views
WHERE author_id = viewer_id
GROUP BY author_id
ORDER BY author_id ASC;
```
其中,`Views` 是查询的表名,`author_id` 是要分组和排序的列名,`viewer_id` 是筛选条件,`ASC` 表示升序排序。
阅读全文