May 6, 2015
0
Level 32
Count on a Polymorphic Relationship with criteria
Say I have a Strategy table which has a polymorphic relationship with 3 other tables of Strategy 1, Strategy 2 and Strategy 3.
I need to count how many records there are in just one of the linked tables (i.e. Strategy 2) that match a criteria, i.e. the value of a field is > 150.
I really can't get my head around how to do it.
Any ideas?
Just to give an idea of the relationships...
User HAS MANY Strategies
Strategies HAVE MANY "sub" strategies.
Please or to participate in this conversation.