SELECT 
	CASE WHEN ISNULL(B.codeProfil) THEN '0' ELSE '1' END AS choix, 
	IFNULL(B.id,0) AS id_menuutilisateur,	
	A.codeMenu, 
	A.libeleMenu, 
	A.ordre
	FROM menu A 
LEFT JOIN  menuutilisateur B ON (B.codeMenu=A.codeMenu)
AND (B.codeSociete='vitalis') AND (B.codeProfil='PRD')
WHERE ('PRD'>' ') AND (A.enVigueur="1")
ORDER BY 
1 DESC, 
A.ordre, 
libeleMenu;



CALL sp_get_utilisateur_profil('vitalis','PRD')

SELECT A.*
FROM menu A
JOIN menuutilisateur B ON (B.codeMenu=A.codeMenu)
WHERE (B.codeSociete='vitalis')
AND (codeProfil='PRD') 
AND (A.enVigueur="1")
ORDER BY A.ordre, 2;


SELECT 	C.*
	
	/*A.codeProfil, 
	C.libelle AS profil,
	A.vue, 
	A.codeMenu,
	B.libeleMenu,
	B.descriptionMenu,
	B.ordre*/
FROM menuvueutilisateur A
JOIN menuvue B ON (B.vue=A.vue)
AND (B.codeMenu=A.codeMenu)
JOIN profil C ON (C.codeProfil=A.codeProfil)	
WHERE (A.codeprofil='PRD')
AND (B.enVigueur="1")
ORDER BY A.vue, B.ordre;
 