[thelist] sql query help

Chris Blessing webguy at mail.rit.edu
Fri May 24 12:47:09 CDT 2002


Rudy, Yousuf, Josh, Sean, Eric -- thanks a ton for the help.  It turns out I
screwed up the db somehow and all 120,000 rows were set to sort_order = 1,
hence my problem getting any real expectant results back.  But I will
remember this for future tips/questions. :D

Have a great weekend!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of rudy
> Sent: Friday, May 24, 2002 1:37 PM
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] sql query help
>
>
> > select article_id
> > from paragraphs
> > group by article_id, sort_order
> > having count(*) > 1
>
> pretty close, joshua, but your group by list is not the same as
> your select
> list, so most databases will give a syntax error (mysql will give results
> but they aren't useful)
>
> chris, try
>
>   select article_id, count(*)
>      from paragraphs
>     where sort_order=1
>  group by article_id
>    having count(*) > 1
>
> this returns article_d and number of sort_order=1 paragraphs if
> more than 1
>
>
> rudy
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list