I have a table that looks like this:
ClientId FloorNum BedNum IsActive 11 2 212 1 12 2 214 0 12 2 214 1 13 2 215 0 13 2 215 0 13 2 215 0 13 2 215 0 13 2 215 1 12 2 215 1
As you can see, the combination FloorNum / BedNum 2/215 has two lines, where IsActive is 1. This cannot be.
On the other hand, a single FloorNum / BedNum combination can have many rows, where IsActive is 0.
How to add a constraint to a table so that the FloorNum / BedNum combination has only one row, where IsActive = 1?
Any help is appreciated.
rbhat source share