I have a need to create a view. The data table does not exist yet, the question is on how to best set it up in postgres. The resulting view has to be spreadsheet-like, and will be loaded directly via ODBC into Excel for number crunching. Maybe something like:
I could mirror that exact structure in a SQL table, but I'd loose the relation (since the column headings actually refer to an associated table). Now if I were just working in pure SQL, I'd build it in a relational manner, with a long series of rows:
It would be relational, but I don't know how to convert it to a sorted and grid-like "view", without a (perl) script. Any thoughts on this? One thought is to swap the rows and columns. But then I have dates as the column names, which seems inelegant. |