Advertisement
JouJoy

Untitled

Dec 22nd, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. CREATE VIEW DetWareShip AS
  2. select d.product_id as [ID детали],
  3. d.name as [Наименование детали],
  4. d.product_type as [Тип детали],
  5. w.warehouse_id as [Хранится на складе №],
  6. w.quantity_in_stock as [Остаток на складе],
  7. w.last_operation as [Дата последней операции с деталью] ,
  8. s.buyers_code as [Код покупателя],
  9. s.warehouse_id as [Куплено со склада №],
  10. s.number as Количество,
  11. s.unit as [Ед.изм.],
  12. s.shipping_date as [Дата отгрузки]
  13. from details d
  14. join warehouse w on w.product_id=d.product_id
  15. join shipment s on s.code_product=d.product_id and s.warehouse_id=w.warehouse_id
  16. where w.last_operation>=ALL(select last_operation from warehouse where warehouse.product_id = d.product_id)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement