I have a query that goes like this:
SELECT O.Officename, HF.Label, AF.StrValue, D.Dept
FROM Office O
INNER JOIN Dept D ON O.UID = D.OfficeUID
INNER JOIN Asset A ON D.UID = A.DeptUID
INNER JOIN CatHWItem I ON I.UID = A.ItemUID
INNER JOIN CatHWManifacturer M ON I.UIDManifacturer = M.UID
INNER JOIN CATHWType T ON M.TypeUID = T.UID
INNER JOIN AssetFields AF ON A.UID = AF.AssetUID
INNER JOIN HWFields HF ON AF.FieldUID = HF.UID
WHERE T.NAME = 'Workstation'
AND AND HF.Label = 'service tag'
AND HF.Label = 'barcode'
GROUP BY O.Officename, HF.Label, AF.StrValue, D.Dept
ORDER BY OfficeName ASC
My problem with this query is that I can't get back both the 'barcode' and the 'service tag' at the same time. It's either one or the other.
How can I get both in one shot? I figured I need a subquery and a WHERE EXISTS but I'm not sure.