added important sql query to FLATTEN_QUANTUM_ON_DISTINCT_MENTION