I have a relation:

A product can have stockproducts. Stockproducts are a combination of a product and a stock. The stock 'main' is alway there.

Now I'd like to do:

product_list = Product.mapper.select()

product_list[123].mainstock

The result would be a COUNT of all the orderproducts in the main stock.

So what the function sql-wise should do is adding a subquery '(SELECT COUNT(id) FROM stockproducts WHERE product_id=product.id)'.

Is this possible?

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to