Open prashantnirgun opened 1 year ago
Hi This is not any issue help is required, Let say I have user_groups and users table and users table has user_group_id column I want to generate output like this also has where condition users_group.branch_id = 10
[ { 'user_group.id' : 1, 'user_group.name' : 'Admin', 'user_group.branch_id' : 10, users : [ {'users.id' : 1, 'users.name' : 'Prashant'}, .... ] }]
can query builder does any kind or magic here other wise I have to manually parse the result set and generate the desired output.
Not directly, but yes you can use group by and then collate for the desired result or use some high-order function like reduce to do that.
Hi This is not any issue help is required, Let say I have user_groups and users table and users table has user_group_id column I want to generate output like this also has where condition users_group.branch_id = 10
[ { 'user_group.id' : 1, 'user_group.name' : 'Admin', 'user_group.branch_id' : 10, users : [ {'users.id' : 1, 'users.name' : 'Prashant'}, .... ] }]
can query builder does any kind or magic here other wise I have to manually parse the result set and generate the desired output.