AS being ignored in a subquery

michaelsv650

New Member
Still learning SQL here... I have part of a subquery:\[code\](Select MAX(cost) AS Cost_of_Car FROM Car_Purchase)\[/code\]But it does not take my label just uses the one from the table, in this case "cost"Any ideas?EDIT: Just realized I could in my SELECT statement call out AS "NAME OF COLUMN", but why does it not accept AS in the subquery?POSTING FULL QUERY\[code\]SELECT CAR.name, Car_Purchase.cost_per_night, Car_Purchase.descriptionFROM Car_PurchaseJOIN CAR ON Car_Purchase.purchase_id = CAR.purchase_idGROUP BY CAR.name, Car_Purchase.cost_per_night, Car_Purchase.descriptionHAVING Car_Purchase.cost = (SELECT MAX(cost) AS Cost_of_Car FROM Car_Purchase)\[/code\]
 
Top