Skip to content

Instantly share code, notes, and snippets.

@iamsardorbek
Created July 29, 2022 05:14
Show Gist options
  • Save iamsardorbek/c4ae6ef1d09cf6b7bc4b840b0029f6ff to your computer and use it in GitHub Desktop.
Save iamsardorbek/c4ae6ef1d09cf6b7bc4b840b0029f6ff to your computer and use it in GitHub Desktop.
assortment_check_equipment.sql
select t.Company_Id,
(select k.Name
from Md_Companies k
where k.Company_Id = t.Company_Id) Company_Name,
t.Assortment_Id,
(select k.Name
from Tmcg_Assortments k
where k.Company_Id = t.Company_Id
and k.Assortment_Id = t.Assortment_Id) Assortment_Name,
t.Product_Id,
(select k.Name
from Mr_Products k
where k.Company_Id = t.Company_Id
and k.Product_Id = t.Product_Id) Product_Name
from Tmcg_Assortment_Person_Type_Inventories t
where exists (select *
from Mr_Product_Inventories k
where k.Company_Id = t.Company_Id
and k.Product_Id = t.Product_Id
and k.Inventory_Kind = 'E')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment