how to fetch the active record by passing the ID in Sql server
I have the following database design:
Table Content ID Status ReplacedId
1 C NULL 2 C 1 3 C 2 4 A 3 5 A NULL 6 A NULL 7 A NULL
the logic here is as follows
Id "1" is Canceled and instead that ID "2" is created so the Record 2 has
a reference to the ID "1" in the ReplacedId column. like that iD 2 is
canceled and Id "3" is created , "3" is canceled and "4" is created. the
canceled records status is "C" and the Active records Status is "A"
My Requirement :
i have to show the Active record for the Id by passing the Id (1) if that
is a canceled record othere wise the same record if that is a active
record.
No comments:
Post a Comment