BrickTracker/bricktracker/sql/minifigure/list/missing_part.sql

31 lines
747 B
MySQL
Raw Normal View History

2025-01-17 11:03:00 +01:00
{% extends 'minifigure/base/select.sql' %}
{% block total_missing %}
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
{% endblock %}
{% block join %}
LEFT JOIN "missing"
ON "minifigures"."fig_num" IS NOT DISTINCT FROM "missing"."set_num"
AND "minifigures"."u_id" IS NOT DISTINCT FROM "missing"."u_id"
{% endblock %}
2025-01-17 11:03:00 +01:00
{% block where %}
WHERE "minifigures"."fig_num" IN (
2025-01-17 11:03:00 +01:00
SELECT
"missing"."set_num"
FROM "missing"
2025-01-17 11:03:00 +01:00
WHERE "missing"."color_id" IS NOT DISTINCT FROM :color_id
AND "missing"."element_id" IS NOT DISTINCT FROM :element_id
AND "missing"."part_num" IS NOT DISTINCT FROM :part_num
2025-01-17 11:03:00 +01:00
GROUP BY "missing"."set_num"
2025-01-17 11:03:00 +01:00
)
{% endblock %}
{% block group %}
GROUP BY
"minifigures"."fig_num"
{% endblock %}