M$ Access "crosstab" query tab PostgreSQL equivalent

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: M$ Access "crosstab" query tab PostgreSQL equivalent
Date: 2007-02-24 18:12:00
Message-ID: 87hctbe87j.fsf@patagonia.sebmags.homelinux.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm unable to find how to construct a query like the one mentioned in the
Subject. The Access query looks like this:

TRANSFORM Last(Attendance.period) AS LastPeriod
SELECT table1.sp, table2.tag
FROM (table2 RIGHT JOIN table1 ON table2.id = table1.id)
LEFT JOIN table3 ON table1.id = table3.id
GROUP BY table1.sp, table1.tag
ORDER BY Format([Date],"Medium Date")
PIVOT Format([Date],"Medium Date");

An older thread on Usenet indicated a long time ago, that these type of
queries are not supported in PostgreSQL.

I've also not found a PostgreSQL equivalent to function First() used in
Access SQL to extract the first value for data in grouped queries, such as
the one above.

I'd appreciate some suggestions on how these two things can be achieved in
PostgreSQL.

Cheers,

--
Seb

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-02-24 18:27:22 Re: M$ Access "crosstab" query tab PostgreSQL equivalent
Previous Message Pavan Deolasee 2007-02-24 17:32:24 Re: [HACKERS] 5 Weeks till feature freeze or (do you know where your patch is?)