Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- concat(`m`.`title`,"_",`a`.`title`) as `module_action`,
- if(isnull(`sp`.`flag`),0,1 ) as `is_sertificate`,
- if(isnull(`sp`.`flag`), `gp`.`flag`, `sp`.`flag`) as `flag`
- from `users` `u`
- left join `groups` `g`
- on `g`.`id` = `u`.`group_id`
- left join `group_permissions` `gp`
- on `gp`.`group_id` = `g`.`id`
- left join `actions` `a`
- on `a`.`id` = `gp`.`action_id`
- left join `modules` `m`
- on `m`.`id` = `a`.`module_id`
- left join `user_sertificates` `us`
- on `us`.`user_id` = `u`.`id`
- left join `sertificates` `s`
- on `s`.`id` = `us`.`sertificate_id`
- left join `sertificate_permissions` `sp`
- on `sp`.`sertificate_id` = `us`.`sertificate_id`
- and `sp`.`action_id` = `a`.`id`
- where `u`.`id` = 1
- -- group by `a`.`id`
- order by `a`.`id` asc, `s`.`power` desc, `us`.`createdOn` desc, `sp`.`flag` desc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement