On 6/18/07, Derek Watson <[EMAIL PROTECTED]> wrote: > Postgres defines the function separately from count(*): > > count(expression) number of input values for which the value of > expression is not null > > In this case I would write > > SELECT COUNT(coalesce(t1.a_id, t1.b_id)) > > Which would count the number of rows that have at least one non-null > value in the primary keys. Is that enough, or do we need to be > explicit and only count rows where every piece of the primary key is > not null?
You need the DISTINCT part if you join with any ...-to-many relationship. I'm not sure in your example if the DISTINCT should have been there, but I can imagine cases where it will need to be there, so we need some way to do it. -John ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object