I have two tables:
PK-QualficiationID (Part of composite PK)
PK-QualificationID (Part of Composite PK)
I want to place a check constraint on tbl_ProjectEmployee that does not exceed the QualificationCount in the second table.
Here's my code but I'm stuck:
ALTER TABLE dbo.tbl_ProjectEmployee ADD CONSTRAINT CK_QualificationID
CHECK (QualificationID <= (Select QualificationCount from dbo.tbl_ProjectQualification pq
where pk.QualificationID = QualificationID)
Msg 1046, Level 15, State 1, Line 2
Subqueries are not allowed in this context. Only scalar expressions are allowed.