When i select on xml and store the result in html or csv i get duplicate results but when i query for that particular record i get only one,because of this i get unqiue constrant error when i try to insert to database.

We usally do not like to give patches out, as that would counter productive for us, but we can make exception, as this may be faster route this time. Just place this jar file in the "<jboss-as>server/default/lib" directory. Also, I built this from lastest code on "trunk", so use the "teiid-7.2-beta1" if you can. You can get that from Teiid web site.

I get the below error when i try using your patch,i did update to 7.2 Beta 1.

2010-10-22 11:24:22,708 DEBUG [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) [Ljava.lang.Object;@1753a96java.lang.IllegalAccessError: tried to access method org.teiid.query.processor.relational.RelationalNode.getDataManager()Lorg/teiid/query/processor/ProcessorDataManager; from class org.teiid.query.processor.relational.NestedTableJoinStrategy at org.teiid.query.processor.relational.NestedTableJoinStrategy.initialize(NestedTableJoinStrategy.java:60) at org.teiid.query.processor.relational.JoinNode.open(JoinNode.java:136) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalPlan.open(RelationalPlan.java:152) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:134) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchIterator.finalRow(BatchIterator.java:70) at org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:69) at org.teiid.query.processor.BatchIterator.getCurrentTuple(BatchIterator.java:82) at org.teiid.common.buffer.AbstractTupleSource.hasNext(AbstractTupleSource.java:91) at org.teiid.query.processor.proc.ProcedurePlan.executePlan(ProcedurePlan.java:447) at org.teiid.query.processor.proc.CreateCursorResultSetInstruction.process(CreateCursorResultSetInstruction.java:68) at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:301) at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:240) at org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:162) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:161) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:150) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:115) at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:249) at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:183) at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49) at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:189) at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:116) at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:290) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)2010-10-22 11:24:22,708 ERROR [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) Unexpected exception for request abfYQtQ2PmVQ.5java.lang.IllegalAccessError: tried to access method org.teiid.query.processor.relational.RelationalNode.getDataManager()Lorg/teiid/query/processor/ProcessorDataManager; from class org.teiid.query.processor.relational.NestedTableJoinStrategy at org.teiid.query.processor.relational.NestedTableJoinStrategy.initialize(NestedTableJoinStrategy.java:60) at org.teiid.query.processor.relational.JoinNode.open(JoinNode.java:136) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalPlan.open(RelationalPlan.java:152) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:134) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchIterator.finalRow(BatchIterator.java:70) at org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:69) at org.teiid.query.processor.BatchIterator.getCurrentTuple(BatchIterator.java:82) at org.teiid.common.buffer.AbstractTupleSource.hasNext(AbstractTupleSource.java:91) at org.teiid.query.processor.proc.ProcedurePlan.executePlan(ProcedurePlan.java:447) at org.teiid.query.processor.proc.CreateCursorResultSetInstruction.process(CreateCursorResultSetInstruction.java:68) at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:301) at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:240) at org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:162) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:161) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:150) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:115) at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:249) at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:183) at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49) at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:189) at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:116) at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:290) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)2010-10-22 11:24:22,708 DEBUG [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) QueryProcessor: closing processor2010-10-22 11:24:22,708 DEBUG [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) Removing tuplesource for the request abfYQtQ2PmVQ.52010-10-22 11:24:22,708 DEBUG [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) [Ljava.lang.Object;@15979afjava.lang.IllegalAccessError: tried to access method org.teiid.query.processor.relational.RelationalNode.getDataManager()Lorg/teiid/query/processor/ProcessorDataManager; from class org.teiid.query.processor.relational.NestedTableJoinStrategy at org.teiid.query.processor.relational.NestedTableJoinStrategy.initialize(NestedTableJoinStrategy.java:60) at org.teiid.query.processor.relational.JoinNode.open(JoinNode.java:136) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalNode.open(RelationalNode.java:250) at org.teiid.query.processor.relational.RelationalPlan.open(RelationalPlan.java:152) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:134) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchIterator.finalRow(BatchIterator.java:70) at org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:69) at org.teiid.query.processor.BatchIterator.getCurrentTuple(BatchIterator.java:82) at org.teiid.common.buffer.AbstractTupleSource.hasNext(AbstractTupleSource.java:91) at org.teiid.query.processor.proc.ProcedurePlan.executePlan(ProcedurePlan.java:447) at org.teiid.query.processor.proc.CreateCursorResultSetInstruction.process(CreateCursorResultSetInstruction.java:68) at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:301) at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:240) at org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:162) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:274) at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:161) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:150) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:105) at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:115) at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:249) at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:183) at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:49) at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:189) at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:116) at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:290) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)2010-10-22 11:24:22,708 DEBUG [org.teiid.PROCESSOR] (Worker1_QueryProcessorQueue12) abfYQtQ2PmVQ.5 end processing WORKING

You need to be working with the latest 7.2-beta1 release. As I said the patch is from my workspace, which is trunk. I am not sure what are other changes went in. That is reason it is it wold be best if you build it from source, as you would get a consistent build.