I need to be able to enter duplicate entries in Table B, with different foreign keys (Table B references Table A’s key). Like this:
Table A:
Record with key of 11
Record with key of 22
Table B:
Record referring to Table A record 11, with a field marked unique: value 101
Record referring to Table A record 22, with a field marked unique: value 101 <--- violates the unique key
This is what I have tried, but didn’t work:
CREATE TABLE Readings (
SITE_ID TEXT REFERENCES SiteData
, LOOP_NBR TEXT
, LOOP_CLOSED BINARY
, SEQ INTEGER
, STA TEXT UNIQUE
, BS TEXT
, FS TEXT
, HI TEXT
, DESC TEXT
)
INSERT INTO Readings (SITE_ID, SEQ) VALUES (' + databaseKey + ', 0)
Anybody know how to do this?
Adding UNIQUE to the foreign key will refuse only rows with same SITE_ID and STA