I have a database "accessdept":
userid | dept
00001 | IS
00001 | Account

accessdept is 1 to many, mean that this user with userid 00001 can view report of dept IS and Account.

Another database "dept" store all the dept:
dept
IS
Account
HR
bla bla bla...

How should I code while they want update the dept which user 00001 can access,
the checkbox should checked if user can access before
for this eg.the IS and Account is checked, and other dept is uncheck.
My query is below :

String sqldept = "SELECT dept FROM dept";

<%
ResultSet rsdept;
synchronized(stmtdept){
rsdept = stmtdept.executeQuery();
}

while(rsdept.next()){
%>
<input name="tick" type="checkbox" value="<%=rsdept.getString("dept")%>"><%=rsdept.ge tString("dept")%>
<%
}
%>

For my coding above, all the checkbox is unchecked. How to make the dept that can accessed BEFORE is checked?

IT'S MUCH APPRECIATED if anyone give me some idea~