Re: [sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-15 Thread Max Vlasov
Simon, I think the Group by might work correctly, but sometimes (as in OP case) would require a lot of rewriting (copy-paste). The key point here is that the Window function doesn't change the set, but only allows wider access to other rows of the set at the current row "time". So we just have to

Re: [sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-06 Thread Simon Slavin
On 6 Apr 2018, at 8:58pm, R Smith wrote: > my guess is Mr. Thomas inherited it from someone else who did not fully know > what they wanted to achieve, then googled a solution and found a hit on an > old stackoverflow question that was sort-of like what they wanted, but not

Re: [sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-06 Thread R Smith
On 2018/04/06 9:15 PM, Don V Nielsen wrote: That seems like an odd application of OVER (Partition by). Is there some performance reason one would want to do DISTINCT OVER (PARTITION BY) instead of a simple GROUP BY Sites.Customer, Sites.Digit, Count()? Agreed, in fact half that query seems

Re: [sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-06 Thread Don V Nielsen
That seems like an odd application of OVER (Partition by). Is there some performance reason one would want to do DISTINCT OVER (PARTITION BY) instead of a simple GROUP BY Sites.Customer, Sites.Digit, Count()? On Fri, Apr 6, 2018 at 12:20 PM, Simon Slavin wrote: > On 5 Apr

Re: [sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-06 Thread Simon Slavin
On 5 Apr 2018, at 11:41am, DThomas wrote: > Select DISTINCT Sites.Customer, Sites.Digit, > Count(TblContractTasks.TaskNumber) > OVER (PARTITION BY Sites.Digit) As TaskCount > FROM TblContractTasks INNER Join (Sites INNER Join TblContractDetails On > Sites.Digit =

[sqlite] SQLite equivalent of SQL Over(Partition)

2018-04-06 Thread DThomas
Hello I have the following query in SQL Server 2008. The database has been moved to a mobile device using SQLite. Can anyone help with a equivalent statement for SQLite? Select DISTINCT Sites.Customer, Sites.Digit, Count(TblContractTasks.TaskNumber) OVER (PARTITION BY Sites.Digit) As TaskCount