Thanks for the responses. All but the middle view (with the decodes in it) are now solved. I now know that it is supposed to be "case when", but i can't get it to take the floor of the average of a group that has been converted to numbers. Does anybody have any suggestions for coding? Or am i going to be force to create one view in pg that references another view?