| 88 | |
| 89 | === Извештај за остатокот од гаранцијата во денови на купениот производ |
| 90 | |
| 91 | {{{ |
| 92 | select |
| 93 | category.category_name, |
| 94 | product.product_name, |
| 95 | order_table.order_id, |
| 96 | date_trunc('day', (order_table.order_date + interval '1 year' * product.product_warranty) - now()) as remaining_warranty |
| 97 | from |
| 98 | order_table |
| 99 | join order_table_contains_product on order_table.order_id = order_table_contains_product.order_id |
| 100 | join product on order_table_contains_product.product_id = product.product_id |
| 101 | join product_is_in_category on product_is_in_category.product_id = product.product_id |
| 102 | join category on category.category_id = product_is_in_category.product_id |
| 103 | }}} |