Subquery join replaces primary key
@embali you should use [code formatting](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) to make your issue more readable.
 Indeed, I'm confused why people expect me to spend time answering the question they were too lazy to write properly.
 Try changing the join on the subquery to:

``` python
        .join(
            categories_,
            on=(models.Category.uid == categories_.c.uid).alias('xx'))\
```

Hello,

I have models
Category:
  uid - primary key
Tag:
  uid - primary key
CategoryTag:
  uid - promary key
  category - foreign key to Category
  tag - foreign key to Tag

And using this to get all categories with tag uid list for each category:

``` python
    categories_ = models.Category\
        .select()\
        .paginate(CATEGORIES_COUNT/LIMIT, paginate_by=LIMIT)\
        .alias('categories_')
    categories = models.Category\
        .select(models.Category, models.CategoryTag)\
        .join(
            categories_,
            on=(models.Category.uid == categories_.c.uid))\
        .join(models.CategoryTag, join_type=peewee.JOIN.LEFT_OUTER)\
        .aggregate_rows()
```

But, after that if I try to get uid (categories[0].uid) for any category it will be an empty list, but not uid value, if it is getting replaced, how can I fix this? Without that joining subqueries is useless
