[thelist] sql query help

rudy r937 at interlog.com
Fri May 24 12:37:00 CDT 2002


> 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




More information about the thelist mailing list