所以我想在我的查询中创建3列。需要重命名查询中的其中一列,并使用Composer列中的值。这就是我到目前为止所做的:
CREATE VIEW [Multiple Composers] AS
SELECT Name, Composer FROM Track
WHERE Composer LIKE '%/%'
AND Composer NOT LIKE 'AC/DC'
不确定如何做到这一点,并会感谢一些建议
答案 0 :(得分:1)
您可以使用AS Clause从现有列创建新列,这允许您为项目指定别名。如果要在新创建的列上创建条件,请使用临时表。
with tmpTable as
(select name, composer, composer as newComposer from Track)
select name, composer, newComposer from tmpTable where composer like'%/%' and newComposer not like 'AC/DC';