Jeff, > I'm wondering if its somehow possible to create a pk/fk constraint for > the table below
> create table Example ( > id int not null auto_increment primary key, > table_name enum('TabA','TabB') not null, > table_id int not null > ) type = InnoDB; > if table_name is 'TabA', then I want to make sure the row exists in > TabA. Likewise if table_name is 'TabB' You can find the syntax for MySQL / InnoDB and a good example here: http://www.mysql.com/doc/en/SEC463.html To avoid trouble, consider this sentence from that page: Both tables have to be InnoDB type and there must be an index where the foreign key and the referenced key are listed as the FIRST columns. InnoDB does not auto-create indexes on foreign keys or referenced keys: you have to create them explicitly. The example on that page, however, shows exactly how you'd do that. Regards, -- Stefan Hinz <[EMAIL PROTECTED]> iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Telefon: +49 30 7970948-0 Fax: +49 30 7970948-3 [filter fodder: sql, mysql, query] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]