This commit is contained in:
2024-12-10 18:09:15 +03:00
parent 5bf6f4e30b
commit 8ec0cf6b58
3 changed files with 22 additions and 6 deletions

View File

@@ -8,4 +8,9 @@ repos:
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- id: isort
- repo: https://github.com/sqlfluff/sqlfluff
rev: 3.3.0
hooks:
- id: sqlfluff-fix
args: [ --dialect=mariadb ]

View File

@@ -1 +1,5 @@
SELECT DISTINCT material FROM workpiece;
SELECT
work_id,
name,
material
FROM workpiece;

View File

@@ -1,4 +1,11 @@
SELECT weight AS 'Вес', price AS 'Цена (в рублях)',
count AS 'Количество', last_update AS 'Дата последнего обновления'
FROM workpiece
WHERE material = '$material'
SELECT
w.waybill_date AS 'Дата поставки',
s.name AS 'Поставщик',
wl.amount AS 'Количество'
FROM waybill w
JOIN (SELECT waybill_id, work_id, amount FROM waybill_lines) wl USING(waybill_id)
JOIN (SELECT user_id, sel_id FROM external_users) eu USING(user_id)
JOIN (SELECT sel_id, name FROM sellers) s USING(sel_id)
WHERE work_id = '$id'
GROUP BY waybill_date, name;