troubleshooting Question

Help with SQL Command to compare the contents of two table fields

Avatar of hojohappy
hojohappy asked on
Microsoft SQL Server 2008
2 Comments1 Solution235 ViewsLast Modified:
I need help with SQL command.  I have two SQL server tables with I need to validate the contents of one table field against another.  The table [VG-Attributes].LOVs contains a partial set of values but I need to validate these values against the complete set which is in [VG-LOVs].[Combined Field Type Values].

[VG-Attributes].LOVs = No
[VG-LOVs].[Combined Field Type Values]  = Yes;No

I need to report any value from [VG-Attributes].LOVs that is not in [VG-LOVs].[Combined Field Type Values].  For example;

[VG-Attributes].LOVs = XX
[VG-LOVs].[Combined Field Type Values]  = Yes;No


SELECT     [VG-Attributes].LOVs, [VG-LOVs].[Combined Field Type Values]
FROM         [VG-Attributes] INNER JOIN
                      [VG-LOVs] ON [VG-Attributes].LOV_ID = [VG-LOVs].[LOV ID ]
                   where [VG-Attributes].LOVs does not contain all values from [VG-LOVs].[Combined Field Type Values]
ASKER CERTIFIED SOLUTION
Sharath S
Data Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros