sql - Foreign key reference the following error is showing : the columns in the table 'table' do not match an existing primary key or UNIQUE constraint -


i have 2 tables probcodes , workorders

probcodes:

  • primary key : probcodeid
  • column : problemcode

workorders:

  • primary key : workorderid
  • column : problemcode

my question :

how can create foreign key reference between problemcode in probcodes , problemcode in workorders?

by putting unique constraint on problemcode in probcodes.

the error message says all. foreign key in workorders has reference either primary key or unique column in probcodes. otherwise, if there duplicate problemcodes in probcodes, how can sql know row reference in parent table?


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -