Let's say I have a model Listing which has many Tickets, Tickets has status
(either on_sale
or ordered
). Now I want query Listings and if it's tickets has different status
, I want too split it into two records.
For instance, there is 1 listing which has 5 tickets, three of them status
is on_sale
and two of them is ordered
, I want get 1 listing which has 3 tickets with its status
(Listing also has status
) is on_sale
and 1 listing has 2 Tickets and the listing's status is ordered
.
The point is 1 record split into two based on its association's status.