Fix the SQL Query

Fixing the duplication issue, as well as the parsing of the unnecessary line of "Not Applicable", which was triggering an SQL error.