I have 3 companies 1001,1002 ,1003 it could be more and 11 containers with different sizes 1,2,3,4, 5 I want return only the containers that are in the companies that have the same amount or more of specified numbers. for example if I want 2 containers from size 1 and 3 containers from size 2 then only the containers in the company that has 2 or more of size 1 and 3 or more of size 2 should appear let's say that only company 1001 has them then it should appear alone. I tried different queries and post one here but they recommend me to post a new question with the problem that I'm training to make query for.
(Company info and containers info are in two separate tables)
this is what I get when I remove having (basically all the containers in the city that has been selected)
CoID CoName ContainerID Price size1 size2 size3 size4 size5
6000001 hbjjvCompany 2000002 50 1 0 0 0 0
6000001 hbjjvCompany 2000003 50 1 0 0 0 0
6000002 NCompany 2000004 50 1 0 0 0 0
6000001 hbjjvCompany 2000005 100 0 1 0 0 0
6000002 NCompany 2000007 100 0 1 0 0 0
6000001 hbjjvCompany 2000008 200 0 0 1 0 0
6000001 hbjjvCompany 2000009 200 0 0 1 0 0
6000001 hbjjvCompany 2000010 200 0 0 1 0 0
6000002 NCompany 2000011 200 0 0 1 0 0
6000001 hbjjvCompany 2000012 400 0 0 0 0 1
6000003 ghhaCo 2000014 200 0 1 0 0 0
what should I get is
CoID CoName size1 size2 size3 size4 size5
6000001 hbjjvCompany 2 1 3 0 1
of course I want the containers id and the price but I put it heare like this to make it clear that my query show all the containers even if i removed the ContainerID and price.