CREATE TABLE respondent ( id unsigned int not null auto_increment primary key ,name varchar(20) # , etc ... ); CREATE TABLE response ( id unsigned int not null auto_increment primary key ,name varchar(20) ); CREATE TABLE responses ( respondent unsigned int ,response unsigned int ,PRIMARY KEY (respondent, response) ); #### SELECT A.respondent AS respondent FROM responses A JOIN responses B on (A.respondent = B.respondent) WHERE A.response = ? AND B.response = ? #### my $sth = $dbh->prepare_cached( $sql ); $sth->execute( $response_x, $response_y ); $sth->bind_columns( \my ($respondent) ); my @respondents; while ($sth->fetch) { push @respondents, $responses; } $sth->finish;