- or download this
CREATE TABLE USER_BRANCH_XREF (
USER VARCHAR2(20) NOT NULL REFERENCES USERS(USERNAME)
,BRANCH NUMBER NOT NULL REFERENCES BRANCHES(ID)
,CONSTRAINT PRIMARY KEY (USER, BRANCH)
);
- or download this
SELECT branches.id AS value
,branches.name AS branch
...
WHERE users.username = ?
AND user_branch_xref.user = users.username
AND user_branch_xref.branch = branches.id
- or download this
my $sql = <<__END_SQL__;
SELECT branches.id AS value
...
$template->param(
branches => $sth->fetchall_arrayref( {} ),
);