David, You are right of course about sample data..... I've put some data up on Pastebin here http://pastebin.com/EtVnjiYv As for an example of an expected result from the above : - Order individual test results asc/desc as required, so you end up for example with for test1 as shown on paste bin under "sort result for test 1" - Count the number of times each factor appears in an ordered position (e.g as shown by "SORT LOCATIONS FOR TEST 1", I would expect to see a+ shown as appearing twice in first position, y+ twice in second etc. etc.) Hope this helps ! Tim -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general