Hi, I was wondering if Postgresql (8.3 or later) had an equivalent function to the MS-SQL function "unpivot"? I've spotted the user contributed crosstab which is similar to the "pivot" function, but I can't find an equivalent "uncrosstab". Essentially what I'm trying to do is take a table like this... clientID clientName contact1 contact2 contact3 contact4 ----------- -------------------- ----------- ----------- ----------- ----------- 1 ABC Corp 1 34 2 NULL 2 DEF Foundation 6 2 8 9 3 GHI Inc. 5 9 NULL NULL 4 XYZ Industries 24 NULL 6 NULL ...and get a result like this... clientID ContactNumber ContactID ----------- ----------------------- ----------- 1 contact1 1 1 contact2 34 1 contact3 2 2 contact1 6 2 contact2 2 2 contact3 8 2 contact4 9 3 contact1 5 3 contact2 9 4 contact1 24 4 contact3 6 Which can be accomplished with unpivot. For more info I've stolen the example from http://weblogs.sqlteam.com/jeffs/archive/2008/04/23/unpivot.aspx Thanks Josh Vote -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general