SkyPHP/skyphp — Issue #23: distinct group by issue
Author: will123195
Created: 2012-03-02 17:58:55+00:00
State: open

the auto-generated group by is invalid:
`GROUP BY ct_campaign.end_date asc`

AQL:

```
distinct ct_campaign {
id as ct_campaign_id,
name,
slug
where ( archive = 0 or archive is null )
order by end_date asc, iorder, name
}
```

Genereated SQL:

```
SELECT distinct ct_campaign.id as "ct_campaign_id",
ct_campaign.name as "name",
ct_campaign.slug as "slug"
FROM ct_campaign as ct_campaign
WHERE ct_campaign.active = 1 AND ( ct_campaign.archive = 0 or ct_campaign.archive is null )
GROUP BY ct_campaign.end_date asc, ct_campaign.iorder, ct_campaign.name, ct_campaign.id, ct_campaign.slug, ct_campaign.end_date
ORDER BY ct_campaign.end_date asc, ct_campaign.iorder, ct_campaign.name
```