James B. Byrne wrote:
On Tue, May 19, 2009 16:41, Andy Colson wrote:

If your query above is getting you mostly what you want, just use it
as a derived table.


I lack the experience to understand what this means.

If, as you suggest, I use a subquery as the expression to the main
SELECT and for it I use the syntax that returns every distinct
combination of base, quote, timestamp, and type, then what?

Unless I am missing something then I still have too many rows for
those currencies with more than one type.


I was not offering a specific answer, just another tool you could use to massage the data more. What I'm saying is, with that first query you got the data into a new format.... Think of that result set as a table itself.

As if you had done:

create table tmp (lots of field);
insert into tmp select (that big query you first posted)

now can you select from tmp to get your answer? Once again, I may be leading you down the wrong path, and as I said before I don't know your data/layouts, and I didn't study your sql very much.

-Andy

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to