M$ Access "crosstab" query tab PostgreSQL equivalent

Started by Sebabout 19 years ago2 messagesgeneral
Jump to latest
#1Seb
spluque@gmail.com

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

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Seb (#1)
Re: M$ Access "crosstab" query tab PostgreSQL equivalent

am Sat, dem 24.02.2007, um 12:12:00 -0600 mailte Seb folgendes:

Hi,

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

Take a look into contrib, there are a tablefunc.sql - file with
functions like crosstabN().

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.

'ORDER BY' and 'LIMIT 1'?

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net