I want to return a count value in the resultset. This count value uses a different condition from the main query. Is it possible to acheive this using sub-query i.e., in a single query?
SELECT ID, DESC,
(SELECT COUNT(*) FROM TABLE1 WHERE TABLE1.ID=ID AND STATUS_ID=2)
COUNT FROM TABLE1 WHERE STATUS_ID=6
Yes.
However, if you use the same table more than once in a query / subquery, you should use different aliases, to be clear what exactly you are selecting or comparing