Ed Leafe wrote: > Here's an SQL query that works fine in most database products, but > PostgreSQL seems to choke on it: > > select entity_type, entity_fk, count(*) as ent_count from > assignment_rotation > group by entity_type, entity_fk > having ent_count > 1 > > When I run this, I get an error: > > ERROR: column "ent_count" does not exist > SQL state: 42703 > > It seems that Postgres does not recognize column aliases. Since > 'having' applies to the result set, that alias should be present; in > fact, I can order by that alias. > > Anyone know why this happens?
Please try: select entity_type, entity_fk, count(*) as ent_count from assignment_rotation group by entity_type, entity_fk having count(*) > 1 Uwe _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
