我有一个表“campaign_items”,其中包含列(预算,花费),我想使用公式计算剩余预算
剩余预算=预算 – 花费
剩余预算=预算 – 花费
现在我在查询下运行:
select distinct a.budget,a.spent from campaign_items a where campaign_item_id=12345 order by a.budget-a.spent
但是我收到了错误:
ERROR: for SELECT DISTINCT,ORDER BY expressions must appear in select list