SELECT
	x.id AS id,
	x.name AS name,
	x.access_public AS access_public,
	x.access_level_default AS access_level_default,
	y.level AS access_level_attributed
FROM
	calendars AS x
	LEFT OUTER JOIN calendar_access_attributed AS y ON ((x.id = y.calendar_id) AND (y.user_id = $user_id))
GROUP BY
	x.id
;
