On 2015-07-31 03:37 PM, jose isaias cabrera wrote: > > How much I owe you? :-) The holidays was the next question. ;P > Thanks. This will help me understand CTE much deeper/better. Thanks. >
The help is a pleasure, but those CTEs were hacked together to solve the date-time conundrum you've posted - Please don't use them as educational material! I'm not aware of any great CTE tutorials for SQLite on the web, though there must be some, and other readers may offer links to them. We've added a few tutorial-like demos to the script editor for the upcoming public release of SQLitespeed 2 (still in final BETA, release expected late August) for doing fun stuff like drawing Sine/Cosine graphs, Mandelbrot sets and reading/expanding CSV data in a column - but I think a real basic tutorial will help a lot of people more. I'll post some of those tutorials here if anyone is interested, and I hope someone could add some nice web tutorials/resources because CTEs are just brilliant in making life easier and everyone could / should benefit from it. If interested in checking these out in the beta - it can be accessed from here: www.sqlc.rifin.co.za/ but I advise hanging on for the public release. Two great informational pieces can be found here (although this is SQL SERVER based CTE discussions, I think the articles are accessible to all): http://facility9.com/2008/12/a-quick-introduction-to-common-table-expressions/ https://www.simple-talk.com/sql/t-sql-programming/sql-server-cte-basics/ The former contains a host of reasons why CTEs are better to use and both give examples of practical non-recursive CTEs. Cheers, Ryan