pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <greg@turnstep.com>
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com
Subject: Re: SQL Challenge: Arbitrary Cross-tab
Date: Wed, 18 Aug 2004 03:36:41 -0000
Message-ID: <f02adbf424fb41327573d74965e3555b@biglumber.com> (raw)
In-Reply-To: <200408171955.11850.josh@agliodbs.com>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
 
Names shortened to spare the line lengths:
 
SELECT bob.cid,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1) AS tk1,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 1) AS tk2,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 2) AS tk3,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 3) AS tk4,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 4) AS tk5,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 5) AS tk6,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 6) AS tk7,
  (SELECT tid FROM ats WHERE cid=bob.cid LIMIT 1 OFFSET 7) AS tk8,
FROM (SELECT DISTINCT cid FROM ats) AS bob;
 
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200408172335
-----BEGIN PGP SIGNATURE-----
 
iD8DBQFBIs7AvJuQZxSWSsgRAkglAJ9mNEmOYlLPynygMmelvzlqkYoHlwCeJqTb
g5gyh9LztONPCZj32aOEuGI=
=Yy7m
-----END PGP SIGNATURE-----





view thread (16+ messages)  latest in thread

Message-ID: <f02adbf424fb41327573d74965e3555b@biglumber.com>
Permalink:  ../f02adbf424fb41327573d74965e3555b@biglumber.com/
Also on:    postgresql.org/message-id/f02adbf424fb41327573d74965e3555b@biglumber.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: greg@turnstep.com, josh@agliodbs.com
  Subject: Re: SQL Challenge: Arbitrary Cross-tab
  In-Reply-To: <f02adbf424fb41327573d74965e3555b@biglumber.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox