SELECT branches.id AS value ,branches.name AS branch FROM users ,branches ,user_branch_xref WHERE users.username = ? AND user_branch_xref.user = users.username AND user_branch_xref.branch = branches.id