I was looking at [some](https://stackoverflow.com/questions/2311481/how-to-use-join-in-zend-framework) [questions](https://stackoverflow.com/questions/3255466/how-can-i-join-tables-in-zend-while-using-a-class-that-inherits-from-zend-db-tab) that ask how to do joins in Zend Framework queries, but the answer is always something like "just do `setIntegrityCheck(FALSE)`".

My question is: **why do I need to do this?**

It seems to me disabling "integrity checks" is not the proper way of making this work. In my particular case, I'm using a MySQL database with some InnoDB tables with foreign keys, so for example:

```
CREATE TABLE IF NOT EXISTS `tableA`
(
`id` CHAR(6),
`name` VARCHAR(255),
PRIMARY KEY (`id`)
) ENGINE=InnoDB;

CREATE TABLE IF NOT EXISTS `tableB`
(
`tableA_id` CHAR(6),
`somefield` VARCHAR(255),
PRIMARY KEY (`tableA_id`)
) ENGINE=InnoDB;

ALTER TABLE `tableB` ADD FOREIGN KEY fk1 (`tableA_id`) REFERENCES `tableA` (`id`);

```

(this is a very simplified version of my DB)

And, my query code looks like this:

```
$table = new Zend_Db_Table('tableB');
$select = $table->select(TRUE)
  ->join(array('a' => 'tableA'), 'tableB.tableA_id = a.id');
$result = $table->fetchAll($select);

```

This is giving me the *"Select query cannot join with another table"* exception unless I add the `setIntegrity(FALSE)` to my `$select`.