Hello!
I have a following structure:
Table customer: id, name
Table additional_field: id, name, type
Table additional_data: id, additional_field_id, customer_id, value
There are multiple additional_fields any customer can have a value for. Customer might not have a particular field value set.
I would like to order customers by a value of a particular additional_field.
In pure SQL it’s simple (1000 is an id of the particular field):
SELECT customer.*, `value`
FROM customer
LEFT JOIN additional_data ON
customer.id = additional_data.customer_id AND additional_field_id = 1000
ORDER BY `value` DESC;
Is there a way how to achieve this in NotORM? I tried a lot of ways but either it’s impossible or I just miss something obvious here.
Thanks for any help.