On Monday 18 June 2007 17:32:38 Ovid wrote:
> ----- Original Message ----
> From: Derek Watson <[EMAIL PROTECTED]>
>
> > > It seems like a simple concat (pg operator ||) would work in this case:
> > >
> > > SELECT COUNT(t1.a_id || t1.b_id)
> >
> > Ugh, I forgot the DISTINCT again:
> >
> > SELECT COUNT(DISTINCT t1.a_id || t1.b_id)
> >
> > But this is tested and works properly too.
>
> So what happens when you concatenate the IDs '1', '12' and '11', '2'?

I was thinking the same thing.

> I think you need a separator in there:
>     SELECT COUNT(DISTINCT t1.a_id || '-' || t1.b_id)

How to pick a separator character that is guaranteed not to appear in
the column values, though?

-- 
Lars Haugseth

-------------------------------------------------------------------------
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

Reply via email to