所以我有多个表,我正在尝试创建一个视图来显示我的 select 语句中返回的所有内容。但是,似乎 mysql 不允许创建其中包含子查询的视图。
所以不确定如何将其转换为视图。
Select Title as "AlbumName" ,
Sum(trk1.Price * trk1.Quant) as "TotalSales"
From Album alb
INNER JOIN
(
SELECT AlbumId,
t1.UnitPrice as "Price" ,
t1.Quantity as "Quant"
FROM Track trk
INNER JOIN
(
SELECT TrackId, UnitPrice, Quantity
FROM InvoiceLine
WHERE InvoiceId IN ( SELECT InvoiceId FROM Invoice )
) AS t1 ON (trk.TrackId = t1.TrackId)
) as trk1 ON (alb.AlbumId = trk1.AlbumId)
Group By alb.AlbumId