Jump to content

Identifying materials that belong exclusively to E15 plant


vrv333

Recommended Posts

Hello Guys

 

I am new to SQL and Need your help regarding SQL code to get data from below table.

 

MATERIAL PLANT

M101 E15

M101 B44

M102 E15M102 B55

M103 E15

M103 B01

M104 E15

M105 E15

M106 E15

M106 B44

M106 B01

 

My SQL Output should be M104 E15

M105 E15

 

Basically we want to identify materials that are only exclusive to E15. If the material is in any other plants we don’t want the material in the output.

 

I appreciate all your help

 

Thanks

 

Link to comment
Share on other sites

Hi All

 

I got my answer with below SQL statement. Thanks to everyone

 

SELECT MaterialNumber from TABLE MaterialBranchMasterEDW
WHERE BranchNumber = 'E15'
and MaterialNumber not in (SELECT MaterialNumber from MaterialBranchMasterEDW
where BranchNumber <> 'E15')
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...