This would result in two database hits, but it may perform better.
I would caution that subselects in the WHERE clause can be bad unless
your database is smart enough to handle them. Some databases would
execute that subselect once per every row in the table. (Where clauses are usually run for every row)
Again, this all depends on your database. You have a development.log file that shows you all the sql statements that the app runs. Take those and run them through your database’s query analyzer / explain plan.
This code is typed on the fly, not tested. You should be able to grasp the basic idea though. Let me know how it all goes.