Tried, but the result is not the same
DROP TABLE IF EXISTS theme; DROP TABLE IF EXISTS votesres; CREATE TABLE votesres ( id int PRIMARY KEY AUTO_INCREMENT, yes int, no int ) ENGINE InnoDB; CREATE TABLE theme ( themeid INTEGER PRIMARY KEY AUTO_INCREMENT, name varchar(30) DEFAULT '', votes INT , FOREIGN KEY (votes) REFERENCES votesres (id) ) ENGINE InnoDB; INSERT INTO theme (name) VALUES ('sd'); INSERT INTO votesres(yes) VALUES (2); INSERT INTO votesres(no) VALUES (2); select * from theme; 
votesres.idmust be a non-auto-incremental and foreign key to thethemeid. Because you have a 1 to 1 relationship. In your case, it suffices to make the columnsvotes_yesandvotes_noin thethemetable - ArchDemonselect *from one table; it always provides data for only one table. To output data from several tables, slightly more complex queries are used. In your case, you yourself specify in the query join with another table and specify the conditions for their association (the keys will not look in this case either). And among other things, you didn’t specify a value for the votes field when inserting a record, so there is now NULL and the record is not related to the votesres table. Especially since you inserted 2 entries into it (2, NULL), (NULL, 2) - Mike