SELECT * FROM tblUserAccessLevel l INNER JOIN tblUserContentArea c ON ((l.UserID = @user-id) AND (c.UserID = @user-id))
SELECT @testaccess = Userid FROM tbluseraccesslevel where Userid = @user-id
this I'm curious about. What is the top select for? It won't return anything to the PERL, as only the last one will.