31 lines
789 B
SQL
31 lines
789 B
SQL
{% extends 'minifigure/base/base.sql' %}
|
|
|
|
{% block total_missing %}
|
|
SUM(IFNULL("missing"."quantity", 0)) AS "total_missing",
|
|
{% endblock %}
|
|
|
|
{% block join %}
|
|
LEFT JOIN "missing"
|
|
ON "rebrickable_minifigures"."figure" IS NOT DISTINCT FROM "missing"."set_num"
|
|
AND "bricktracker_minifigures"."id" IS NOT DISTINCT FROM "missing"."u_id"
|
|
{% endblock %}
|
|
|
|
{% block where %}
|
|
WHERE "rebrickable_minifigures"."figure" IN (
|
|
SELECT
|
|
"missing"."set_num"
|
|
FROM "missing"
|
|
|
|
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
|
|
|
|
GROUP BY "missing"."set_num"
|
|
)
|
|
{% endblock %}
|
|
|
|
{% block group %}
|
|
GROUP BY
|
|
"rebrickable_minifigures"."figure"
|
|
{% endblock %}
|