我的查询:
CREATE VIEW SOME_VIEW2 AS
(
SELECT to_char(tbl_albums.album), COUNT(tbl_songs.id) AS "Songs in album"
FROM tbl_songs
LEFT JOIN tbl_albums
ON tbl_songs.album_id = tbl_albums.id
LEFT JOIN tbl_bands
ON tbl_albums.band_id = tbl_bands.id
WHERE to_char(LOWER(TRIM(tbl_bands.band))) = 'metallica'
GROUP BY to_char(tbl_albums.album)
);
我得到的错误:
命令行错误:10 列:12 错误报告:SQL 错误:ORA-00998:必须使用列别名 00998 命名此表达式。00000 -“必须使用列别名命名此表达式”
这不起作用,但是我以前尝试过这个:
CREATE VIEW SOME_VIEW AS
(
SELECT * FROM tbl_albums
);
这很好用,想问一下,第一次查询有什么问题。