[wp-hackers] SELECT DISTINCT .... ORDER BY not working....
Computer Guru
computerguru at neosmart.net
Mon Nov 19 22:00:51 GMT 2007
They're still being sorted by comment_date, but depending on the comments
you have and what posts they're on, you'll possibly be missing comments made
to to the same posts but at a later time.
Basically, it's sorting by date after it takes the unique comment_post_id,
therefore it is not comparing the comment_date for duplicate comment_post_id
comments and so the order is actually wrong for the entire table, but right
for the unique subset... if that makes any sense.
On 11/19/07, Aaron Brazell <emmensetech at gmail.com> wrote:
>
> Adding comment_date as a queried field should show that it is sorted
> in DESC order. Unless something is really borked... which I suppose
> could be but I don't know why. :)
> --
> Aaron Brazell
> Director of Technology, b5media
>
> skype: technosailor
> phone: 410-608-6620
> web: http://technosailor.com
>
> Everything contained in this email is confidential and stuff
>
> On Nov 19, 2007, at 4:27 PM, Computer Guru wrote:
>
> > Nope, not working....
> >
> > Expected result:
> >
> > 493
> > 501
> > 229
> > 485
> > ....
> >
> > Actual result:
> > 501
> > 502
> > 500
> > 491
> > ....
> >
> > That's the same result I get w/ the original SELECT DISTINCT ...
> > GROUP BY
> > query in my OP.
> >
> >
> > On 11/19/07, Aaron Brazell <emmensetech at gmail.com> wrote:
> >>
> >> This works for me...
> >>
> >> SELECT DISTINCT comment_post_id FROM wp_comments
> >> WHERE comment_approved = '1'
> >> GROUP BY comment_id
> >> ORDER BY comment_date DESC
> >>
> >> --
> >> Aaron Brazell
> >> Director of Technology, b5media
> >>
> >> skype: technosailor
> >> phone: 410-608-6620
> >> web: http://technosailor.com
> >>
> >> Everything contained in this email is confidential and stuff
> >>
> >> On Nov 19, 2007, at 4:18 PM, Computer Guru wrote:
> >>
> >>> SELECT DISTINCT comment_post_id FROM wp_comments
> >>> WHERE comment_approved = '1'
> >>> ORDER BY comment_date DESC
> >>
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >
> >
> >
> > --
> > Computer Guru
> > Director,
> > NeoSmart Technologies
> > http://neosmart.net/blog/
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Computer Guru
Director,
NeoSmart Technologies
http://neosmart.net/blog/
More information about the wp-hackers
mailing list