我在此代码的 Select 语句中遇到错误。
SELECT Track.Name, Track.UnitPrice,
Count(*) AS Purchase_count,
Purchase_count * Track.UnitPrice AS Total_per_track
FROM Track
JOIN InvoiceLine ON Track.TrackId = InvoiceLine.TrackId
GROUP BY Track.Name
ORDER BY Total_per_track desc
LIMIT 10;
返回的错误是
Result: no such column: Purchase_count
At line 1:
SELECT Track.Name, Track.UnitPrice,
Count(*) AS Purchase_count,
Purchase_count * Track.UnitPrice AS Total_per_track
FROM Track
JOIN InvoiceLine
ON Track.TrackId = InvoiceLine.TrackId
GROUP BY Track.Name
ORDER BY Total_per_track desc
LIMIT 10;