I have a table where with three columns (A: material #, B: staff group, C: staff name). The table may contain double entries in such a way:
Line 1: Material #1, staff group 1, staff name 1
Line 2: Material #1, staff group 1, staff name 2
In case two or more lines exists and staff name 1 = “X” or staff name 1 = “XX” then set staff name 2 = “double”
In case only one line exists then set staff name = “Y”
The additional challenge is that I have more than one staff group per material #.
I tried the following so far
IF SELECT Material, staff group, COUNT()
FROM table
GROUP By Material, staff group
HAVING COUNT() = 1
BEGIN
set Staff name = ‘X’
WHERE (staff group = ‘staff group 1’) AND (staff name = ‘Y’)
END
But I have difficulties to add the double line plus multiple staff names.