By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE Linking_Table (CaseNumber VARCHAR(20), Owner VARCHAR(20), Article_Link VARCHAR(20))
INSERT INTO Linking_Table VALUES('ABC1234','John','Linked');
INSERT INTO Linking_Table VALUES('ABC2345','Alex','Linked');
INSERT INTO Linking_Table VALUES('ABC3456','John','Linked');
INSERT INTO Linking_Table VALUES('ABC4567','Maria','Linked');
INSERT INTO Linking_Table VALUES('ABC5678','Maria','');
INSERT INTO Linking_Table VALUES('ABC6789','John','');
INSERT INTO Linking_Table VALUES('ABC7900','Alex','');
INSERT INTO Linking_Table VALUES('ABC9011','Issac','Linked');
INSERT INTO Linking_Table VALUES('ABC10122','Issac','Linked');
INSERT INTO Linking_Table VALUES('ABC11233','Issac','Linked');
INSERT INTO Linking_Table VALUES('ABC12344','Issac','Linked');
INSERT INTO Linking_Table VALUES('ABC13455','Issac','Linked');
INSERT INTO Linking_Table VALUES('ABC14566','Maria','Linked');
INSERT INTO Linking_Table VALUES('ABC15677','Maria','Linked');
INSERT INTO Linking_Table VALUES('ABC16788','Maria','Linked');
INSERT INTO Linking_Table VALUES('ABC17899','John','Linked');
INSERT INTO Linking_Table VALUES('ABC19010','John','');
17 rows affected
SELECT Owner,sum(case when Article_Link='Linked' then 1 end) Linked,
sum(case when Article_Link<>'Linked' then 1 end) Not_Linked,
100*sum(case when Article_Link='Linked' then 1 end)/count(*) linked_percentage
FROM Linking_Table
group by Owner
order by Owner
Owner | Linked | Not_Linked | linked_percentage |
---|---|---|---|
Alex | 1 | 1 | 50 |
Issac | 5 | null | 100 |
John | 3 | 2 | 60 |
Maria | 4 | 1 | 80 |
Warning: Null value is eliminated by an aggregate or other SET operation.