I need to write a query where I search any product name it should show me who all has sold this products and the quantity that they have sold.
{ "user": { "id": "1", "full_name": "John" }, "product": { "id": "1", "product_name": "Pen" }, "create_date": "2015-09-18T07:02:46+02:00", }, { "user": { "id": "2", "full_name": "Joe" }, "product": { "id": "1", "product_name": "Pen" }, "create_date": "2015-10-18T07:02:46+02:00", },{ "user": { "id": "2", "full_name": "Joe" }, "product": { "id": "3", "product_name": "Pencil" }, "create_date": "2015-12-18T07:02:46+02:00", },{ "user": { "id": "3", "full_name": "Tim" }, "product": { "id": "3", "product_name": "Pencil" }, "create_date": "2015-12-18T07:02:46+02:00", },{ "user": { "id": "1", "full_name": "John" }, "product": { "id": "3", "product_name": "Pencil" }, "create_date": "2015-12-18T07:02:46+02:00", },{ "user": { "id": "1", "full_name": "John" }, "product": { "id": "1", "product_name": "Pen" }, "create_date": "2015-12-18T07:02:46+02:00", }
Like in the above case if i search for pen it should show me results for pen and pencil and who has sold those and what quantity.
I have no idea if this is possible or how do it start.