On 11/5/2011 4:11 PM, Tom Lane wrote:
Cstdenis writes:
If I understand that you are proposing as
select * from
(select distinct on (user_id) * from stories as s order
by user_id) as foo
order by date_submitted desc limit 10;
No, you always need to sort by *more
Cstdenis writes:
> If I understand that you are proposing as
> select * from
> (select distinct on (user_id) * from stories as s order
> by user_id) as foo
> order by date_submitted desc limit 10;
No, you always need to sort by *more* columns than are listed in
DISTI
On 11/5/2011 12:49 PM, Tom Lane wrote:
Cstdenis writes:
I am trying to write a query that selects recent submissions (sorted by
submission_date) but only selects the most recent one for each user_id.
example query: /select distinct on (user_id) * from stories order by
date_submitted desc limit
On 11/05/11 11:39 AM, Cstdenis wrote:
example query: /select distinct on (user_id) * from stories order by
date_submitted desc limit 10;/
select user_id,max(date_submitted) from stories group by date_submitted;
?
--
john r pierceN 37, W 122
santa cruz ca
Cstdenis writes:
> I am trying to write a query that selects recent submissions (sorted by
> submission_date) but only selects the most recent one for each user_id.
> example query: /select distinct on (user_id) * from stories order by
> date_submitted desc limit 10;/
> However postgres will n
On Sun, Nov 6, 2011 at 12:39 AM, Cstdenis wrote:
> I am trying to write a query that selects recent submissions (sorted by
> submission_date) but only selects the most recent one for each user_id.
>
> example query: select distinct on (user_id) * from stories order by
> date_submitted desc limit 1
I am trying to write a query that selects recent submissions (sorted by
submission_date) but only selects the most recent one for each user_id.
example query: /select distinct on (user_id) * from stories order by
date_submitted desc limit 10;/
However postgres will not allow me to filter out