SELECT
    w.work_id AS "Darba ID",
    w.work_name AS "Darbs",
    w.city AS "Pilsēta",
    w.created_at AS "Izveidots",

    c.category_id AS "Kategorijas ID",
    c.category_name AS "Kategorija",

    i.item_id AS "Pozīcijas ID",
    i.position_code AS "Pozīcija",
    i.item_name AS "Darba apraksts",
    i.spec_number AS "Specifikācijas Nr.",

    u.unit_name AS "Mērvienība",
    u.description AS "Mērvienības apraksts",

    i.quantity AS "Daudzums"

FROM darbs w
JOIN darba_kategorija c ON c.work_id = w.work_id
JOIN tames_pozicija i ON i.category_id = c.category_id
JOIN mervieniba u ON u.unit_id = i.unit_id

ORDER BY i.item_id;