The SQL database I'm working with is behaving strangely. There are a couple of issues, but the main one I want to ask about is what appears to be duplicate entries. I have two tables, order_items and riders. The primary key for the order_items is porder_item, and it is meant to be unique. When I query the database for results from order_items for a particular porder_item, I get one result. When I query for results from order_items inner joined with riders, I get two results, with the same porder_item. The new result row appears to be taken in part from a row that has a different porder_item value when querying the order_items table alone. I've checked my code, and porder_item is never explicitly set, just auto incremented. My first question is: Is this more likely to mean that the data is being inserted incorrectly somehow, or that it's OK but being retrieved incorrectly? My second question is: is this a symptom of a larger problem with the database, or is it more likely to be a code error somewhere?