lundi 11 octobre 2021

exclude duplicate result from sql query

i want to list all sub menu from table sub_menu using checkbox, the table sub_menu has relation to table role_access that contain id from table role_id. when the role_id is user, i want to check sub_menu that role_id is user and uncheck other sub_menu and i succes to do that. but the problem is the sub_menu show duplicate data.

here is my query to show sub_menu select distinct ra.role_id, sm.sub_menu_id, sm.menu_name from sub_menu as sm left join role_access as ra on ra.sub_menu_id = sm.sub_menu_id order by sm.sub_menu_id

here is the result




Aucun commentaire:

Enregistrer un commentaire