On Thu, Feb 18, 2016 at 7:53 PM, R Smith <rsmith at rsweb.co.za> wrote:

> May I offer this CTE from the tutorials in SQLitespeed in case you have a
> Math library linked.
> (your math function names for cos(), sin() and degtorad() may differ):



> with graph(gWidth, aInc, gAngle, gCos, gCosA, gSin, gSinA) AS (
>     SELECT 20, 10, -90, 0, 0, 0, 0
>   UNION ALL
>     SELECT gWidth,aInc,gAngle+aInc,
>            printf('%d',                  round( cos( degtorad( gAngle +
> aInc ) ) * gWidth + gWidth + 1 ) ),
>            printf('%d', gWidth * 2 + 2 - round( cos( degtorad( gAngle +
> aInc ) ) * gWidth + gWidth + 1 ) ),
>            printf('%d',                  round( sin( degtorad( gAngle +
> aInc ) ) * gWidth + gWidth + 1 ) ),
>            printf('%d', gWidth * 2 + 2 - round( sin( degtorad( gAngle +
> aInc ) ) * gWidth + gWidth + 1 ) )
>       FROM graph
>      WHERE gAngle < 720
> )
> SELECT printf( '%4d', gAngle ) AS Angle,
>        printf( '.%'||gCos||'s%'||gCosA||'s', '+', '.' ) AS Cosine,
>        printf( '.%'||gSin||'s%'||gSinA||'s', '+', '.' ) AS Sine
>   FROM graph
>  WHERE gAngle >= 0;
>

Okay, that's going in the presentation.

HOLY COW!

Contrast with my modest:

...
select year, monthName, group_concat(dayOfMonth, ' ')
       from monthDays where year=2016
       group by monthNum
       order by monthNum;

year|monthName|group_concat(dayOfMonth, ' ')
2016|Jan|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
2016|Feb|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
2016|Mar|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
2016|Apr|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
2016|May|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
2016|Jun|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
2016|Jul|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
2016|Aug|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
2016|Sep|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
2016|Oct|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
2016|Nov|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
2016|Dec|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

Next to figure out indentation/line breaks based on the dayOfWeek (which i
have but isn't shown above).


> The first CTE sets up some parameters in the first 3 fields used to draw
> the graph - play with those parameters for fun.
>

i wouldn't even know what to do with them :/.


> (I hope the mail system don't mess up the format too much...)
>

Nope - came across loud and clear.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to