Can anybody tell me why i am getting duplicate value.when i try to
make query.here is the sql statement.what i have written.Kindly find the screen shot also.

SELECT  m.productname,m.unit,e.quantity FROM (MaterialRequisitionOrder AS p INNER JOIN MaterialRequisitionDetail AS e ON p.requisition_no = e.requisition_no) INNER JOIN Materials AS m ON e.item_code = m.item_code where p.requisition_no=129

My guess is that a 'Materials' can have many 'MaterialRequisitionDetail' (1-N relationship).

Now, MaterialRequisitionOrder.requisition_no = 129 gives you a single 'MaterialRequisitionOrder'. 'MaterialRequisitionOrder.requisition_no' gives you a single 'MaterialRequisitionDetail.requisition_no' (1-1 relationship). 'MaterialRequisitionDetail.item_code' gives you many (four in this case) 'Materials' because of 1-N relationship between 'MaterialRequisitionDetail' and 'Materials'.

If I'm right about that 1-N relationship, then your result of the query is correct i.e. you do get multiple 'm.productname, m.unit, e.quantity' tuples.

This question has already been answered. Start a new discussion instead.