Presenting data in 5 Rows & 5 Cols for 25 specific values

From: F Bax <fbax(dot)ca(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Presenting data in 5 Rows & 5 Cols for 25 specific values
Date: 2013-08-03 13:26:31
Message-ID: CAAmqg_BorkCvgY2NzAYkr=9ysrzswOGTtKdtsZ5H4MCpHj5ZVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table containing tasks completed in a game I'm playing. The game
includes an extra BINGO Challenge where each cell of standard BINGO card
contains a particular task to be completed. The goal is score a BINGO
(row, column, diagonal) by completing five (or more) tasks from the BINGO
cards. My task table contains more tasks completed than the one included
in the BINGO challenge.

SELECT task, CASE WHEN task='Task27' THEN 'R1C1' WHEN task='Task32' THEN
'R1C2' ... WHEN task='Task94' THEN 'R5C5' END AS bingo FROM tasks WHERE
bingo IS NOT NULL;

This query will retrieve all tasks related to the BINGO that I have
completed and present them in a simple list. I would like to arrange the
tasks as a BINGO card; so that I can easily see my progress on various rows
& columns working toward a BINGO.

Any suggestions?

BONUS points will be awarded if the query displays a row with 5 NULL values
if no tasks are completed in that row.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargentg 2013-08-03 21:41:01 Re: Presenting data in 5 Rows & 5 Cols for 25 specific values
Previous Message Dmitriy Igrishin 2013-07-27 07:13:15 Re: Unique index and unique constraint