To ensure some form of referential integrity in Myisam (Mysql) I am trying to do updates and insert using subqueries. For example for updating I use this:
update tbl_a
set col_a='test'
where ID=22 and '2' IN (SELECT ID FROM tbl_b) and '33' IN (SELECT ID FROM tbl_c)
However the same principle for inserts doesn't work; it tried something like this:
insert into tbl_a
(
a,
b,
c
)
values
(
now(),
select ID from tbl_b where ID=2,
select ID from tbl_c where ID=23
)
Any idea how to specify (multiple) conditions during insert?
thanks Patrick