Changes between Version 7 and Version 8 of AdvancedAppDevelopment


Ignore:
Timestamp:
09/30/25 03:07:48 (2 weeks ago)
Author:
185022
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AdvancedAppDevelopment

    v7 v8  
    175175select r.region_name as region,
    176176       cat.ctg_name as category,
    177        sum(asales.unitsSold) as totalUnitsSold,
     177       sum(asales.unitsSold)::bigint as totalUnitsSold,
    178178       sum(asales.income) as totalIncome
    179179from ArticleSales asales
     
    286286create or replace function YearlyIncomeProfitAndExpensesByWarehouses()
    287287returns table(
    288     warehouseId bigint,
     288    warehouseId integer,
    289289    warehouseCity varchar(128),
    290290    warehouseRegion varchar(128),
     
    300300       c.city_name as warehouseCity,
    301301       r.region_name as warehouseRegion,
    302        extract(year from o.ord_date) as "year",
    303        sum(o.ord_sum) as totalIncome,
    304        sum(ord_sum)-sum(au.unit_cost_price) as total_profit
     302       extract(year from o.ord_date)::double precision as "year",
     303       sum(o.ord_sum)::decimal(10,2) as totalIncome,
     304       (sum(o.ord_sum)-sum(au.unit_cost_price))::decimal(10,2) as total_profit
    305305from warehouse w
    306306         join city c on w.city_id = c.city_id
     
    347347                        and o.ord_date >= p.price_eff_date
    348348                      group by a.art_id, a.art_name, cat.ctg_name)
    349 select art_id,
    350        art_name,
    351        category,
    352        totalUnitsSold,
    353        totalIncome,
    354        totalCost,
    355        totalProfit
     349select ProductSales.art_id,
     350       ProductSales.art_name,
     351       ProductSales.category,
     352       ProductSales.totalUnitsSold,
     353       ProductSales.totalIncome,
     354       ProductSales.totalCost,
     355       ProductSales.totalProfit
    356356from ProductSales
    357 order by totalProfit desc;
     357order by ProductSales.totalProfit desc;
    358358end;
    359359$$;