MySQl. How would you write this query

MySQl. How would you write this query

pMy current query is not returning the correct values. My database is full
of logs, each log contains a code. I'm looking for 4 codes specifically,
say (100, 200, 300, 400). /p pI need to know how many times a certain
session_id activated only 1 code, 2 of the codes, 3 of the codes, and all
4 of the codes. /p pThe query will be run 4 different times taking in a
different parameter each time (1,2,3,4)./p pSo if there is a log with each
of the codes with the same session_id that will be +1 when I run the query
for 4./p