select id_item from tablename where (prop = 'naz2' and val = 2) or (prop = 'naz1' and val = 1)
group by id_item
having count(0)=2
select id_item from tablename t1
join tablename t2 using(id_item)
where (t2.prop = 'naz2' and t2.val = 2) and (t1.prop = 'naz1' and t1.val = 1)
Foreign Key Usage and Error Information
You can obtain general information about foreign keys and their usage from querying the INFORMATION_SCHEMA.KEY_COLUMN_USAGE table, and more information more specific to InnoDB tables can be found in the INNODB_SYS_FOREIGN and INNODB_SYS_FOREIGN_COLS tables, also in the INFORMATION_SCHEMA database. See also Section 13.1.17.3, “Using FOREIGN KEY Constraints”.
In addition to SHOW ERRORS, in the event of a foreign key error involving InnoDB tables (usually Error 150 in the MySQL Server), you can obtain a detailed explanation of the most recent InnoDB foreign key error by checking the output of SHOW ENGINE INNODB STATUS.
Использовать локальный кэш тоже не очень хороший вариант, т.к. в БД могут писать их других мест, а данные нужны актуальные.