There are multiple issues with the sql snippet you provided (which I ASSUME is going to be used in javascript during a mysql call?), given your desired result. As I understand it you would like to see a count of the rows that have a specific value for the 'code' column. Assuming you do not need the id returned as well, and only need the count:
SELECT
COUNT(DISTINCT CASE WHEN Code = 'S03' THEN ID END) AS CodeFound,
COUNT(DISTINCT CASE WHEN Code != 'S03' THEN ID END) AS NoCode
FROM A
That should be enough to return it to you. If you needed to check multiple codes at the same time then it would be a good idea to use 'in' or 'not in', but I would add that you will need parentheses around the value(s) such as
not in ('S03')