I have a table with the following fields
id - (int) primary
project_id - (int)
post_id - (int)
I need to set it so that the post_id field is unique but only on a specific project id.
ie:
id || project_id || post_id
1 1 1
2 1 2
3 1 3
4 2 1
5 2 2
6 2 3
is this possible?
EDIT: I now have a new problem, sometimes the post_id field will be null, is there a way of using
ALTER TABLE TableName
ADD CONSTRAINT uc_PostProject UNIQUE (post_id,project_id)
But ignore null post_id's?