As per Income Tax, to avail exemption U/s. 54 you need to invest whole of capital gains only in one house. You cannot invest the same in more than one residential unit. It is immaterial whether it is from same promoter.
Your taxable income depends on the cost of indexation which will be arrived if we can have the date of purchase and cost of purchase.
In the second case the gain will be exempted if you invest in another residential house.
Condition for exemption is that at the time of investment of capital gain you should not have more than one residential house apart from the one you are purchasing i.e at any point of time you can have 2 flats.