Well i examined my query from another prospective and now it works as it should.Thanks