Prefetch with limit might give unexpected results (at least with SQLite3)
This is mentioned here: http://docs.peewee-orm.com/en/latest/peewee/relationships.html#using-prefetch > sometimes does not work, when there are more Invoices with the same number.

Well of course. You're limiting the selection to a single `Invoice` but multiple exist that match the `WHERE` clause. If you need them to be ordered deterministically, then you will need to explicitly order them.

Peewee contains as little magic as possible, so ordering your queries is left to you. Thanks for the explaination.
How about this fix: query `Invoice`, then do a prefetch based on ids from the first query?
I have tables called **Invoice** and **Item**, which essentially look like this:
```
class Invoice(Base):
   number = IntegerField(index=True)

class Item(Base):
    invoice_id = ForeignKeyField(Invoice, backref='items', on_delete='CASCADE')
```

While executing this: `Invoice.select().where(Invoice.number == 1001).limit(1).prefetch(Item)` sometimes does not work, when there are more Invoices with the same number.

In the log I see PeeWee is making two queries with LIMIT, but each returns a different Invoice.
```
('SELECT "t1"."id", "t1"."invoice_id" FROM "item" AS "t1" WHERE ("t1"."invoice_id" IN (SELECT "t2"."id" FROM "invoice" AS "t2" WHERE ("t2"."number" = ?) LIMIT ?))', [1001, 1])
('SELECT "t1"."id", "t1"."number" FROM "invoice" AS "t1" WHERE ("t1"."number" = ?) LIMIT ?', [1001, 1])
```

Turns out, SQLite3 returns undetermined results, depending on number of columns in the query:
```
sqlite> SELECT id FROM invoice WHERE number = 1001 LIMIT 1;
225
sqlite> SELECT id, number FROM invoice WHERE number = 1001 LIMIT 1;
153
```

To fix this I've added `order_by()`.

I propose this issue gets documented. I am not sure if it is only a problem with SQLite3, but maybe there should be an exception raised when using **limit** with **prefetch** without **order_by**, or something like **order_by(id)** should be added as a default.