Filtering by another table value
- jara92
- Member | 1
Hello. I have problem. I need to select some data by another table values.
SQL:
CREATE TABLE `table2` (
`id` INT NOT NULL AUTO_INCREMENT,
`first` BOOLEAN NOT NULL DEFAULT FALSE,
`second` BOOLEAN NOT NULL DEFAULT FALSE,
`third` BOOLEAN NOT NULL DEFAULT FALSE,
`fourth` BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY(`id`)
);
CREATE TABLE `table1` (
`id` INT NOT NULL AUTO_INCREMENT,
`table2_id` INT NOT NULL,
....
PRIMARY KEY (`id`),
CONSTRAINT `table1_table2` FOREIGN KEY (`table2_id`) REFERENCES `table2`(`id`)
);
PHP:
$query = $this->database->table("table1");
$query->whereOr(array(
'table2.first' => $data["first"],
'table2.second' => $data["second"],
'table2.third' => $data["third"],
'table2.fourth' => $data["fourth"]
));
Everything was OK until a reinstalled OS and Xampp. Maybe the PHP version and MySQL version are little different then before. My current php is 7.3.0.
Last edited by jara92 (2019-01-21 16:48)