subQuery in database

I have a marketplace contract that is connected to Moralis. It synced with offerForSale and Bought events.
I want to get tokens that are in offerForSale table and do not exist in Bought table. I know the query is something like this in the postgresSQL but I donโ€™t know how to impelment it in moralis.
SELECT contAddr,tokenid
FROM Offers Offers
WHERE NOT EXISTS ( SELECT contAddr,tokenid
FROM Bought B
WHERE O.contAddr = B.contAddr
AND O.tokenid = B.tokenid)

I donโ€™t know how to do it in mongo db, you could search on google on how to do it with Parse server as Moralis Server is based on Parse server

We are planning on adding support for postgres in the future

1 Like