When creating a table, is it possible to declare a constraint based upon the calculated values of two columns?
Here's the psuedo code explaining what I'm trying to do:
CREATE TABLE employee_comments( id int(11), user_id int(11), franchise_branch_id int(11) default 0, corporate_branch_id int(11) default 0, primary key id, key corp_xor_franch(corporate_branch_id + franchise_branch_id > 0) )
Basically, the user is inserting a comment at either the corporate level or the franchise level. Per comment, either one can be left blank, but at least one MUST be declared.