I would argue that since the code in the first answer isn't massively different to the code in the question, it's not out of the realm of possibility that the the two users came to the same answer independently.
Code from the original question:
$this->db->select('SUBSTRING(zsmonth, 5, 2) as month')
->from('tblsales_month');
Code from answer 1:
$this->db->select('SUBSTRING(zsmonth, 5, 2) as month', FALSE)
->from('tblsales_month');
Code from (deleted) answer 2 (link for 10k users):
$this->db->select('SUBSTRING(zsmonth, 5, 2) as month', FALSE)
->from('tblsales_month');
The only difference between the code in the question and in the answers is the addition of , False
, which isn't substantial.
The only difference between the two answers is the indenting of the second line which is indicative of the user copying the code from the rendered markdown (losing 4 spaces of indentation). Either the second answerer was careless when pasting the code (it was edited to fix the formatting) from the question, or from the answer.
Yes, the answers are two years apart and (as I'm unable to see deleted answers) there was only the question and the existing answer at the time the second answer was posted, but it might be worth giving the benefit of the doubt. If there's a history of the same user copying/pasting answers from others (or the difference between code in the questions and the answers are quite substantial and it's unlikely two users produce the same answers independently), then I'd probably flag for plagiarism.
To answer your question
what did I do wrong? What should've been done in such a situation?
"This question already answered" is probably too vague - moderators have lots to deal with and as others have pointed out, this message you gave your custom flag didn't convey the seriousness of the claim you make.
I would downvote and leave a comment saying the answer is the same as the accepted answer. Something like:
The code in this answer is identical to that of the [accepted answer](link). Did you mean to signal your agreement with the answer by posting it as a second answer? If so, the right thing to do there would be to either post a comment on it, or upvote it. At the moment you lack the sufficient reputation to do either. Please note that copying/pasting the code of others is plagiarism - if this answer is considered plagiarism, it is liable to be deleted.
Were I a 10k user, I'd maybe vote to delete the second answer as it's the same as the first (though as I don't have that privilege I don't know what the guidance is for it).