On 2016/02/18 10:16 PM, Stephan Beal wrote:
> On Thu, Feb 18, 2016 at 8:59 PM, R Smith <rsmith at rsweb.co.za> wrote:
>
>> etc.
>> Nice job on the calendar and good luck with the presentation!
>
> Okay, i've hit a small stump and i'm looking for a hint without giving it
> away:
>
> January and February 2016:
>
> [stephan at host:~/tmp]$ sqlite3 < cal.sql
> 1 2 3
> 4 5 6 7 8 9 10
> 11 12 13 14 15 16 17
> 18 19 20 21 22 23 24
> 25 26 27 28 29 30 31
> 1 2 3 4 5 6 7
> 8 9 10 11 12 13 14
> 15 16 17 18 19 20 21
> 22 23 24 25 26 27 28
> 29
>
> What's missing, obviously, is the month separators/labels. Trying to figure
> that out now.
>
> The indentation wasn't half as problematic as i expected.
>
Not sure how exactly you need the output to look, but you already know
which week lines to indent, those same lines must be preceded with a
Month Label, and the Month name index is just a strftime('%m',...) away,
perhaps joined to another CTE with:
MTHName(mth, name) AS (
SELECT 01, 'Januar' UNION ALL
SELECT 02, 'Februar' UNION ALL
SELECT 03, 'M?rz' UNION ALL
...
SELECT 12, 'Dezember'
)
- Which serendipitously illustrates another use of a CTE.