Project

General

Profile

105_build_projects_tree.rb breaks on sql server

Added by David Daniel about 12 years ago

In order to use sql server as the db from the git head I had to take this file out and make a couple of other changes. The other changes were pretty easy and I see how to change this query to use a top 1 instead of a the row_number over syntax but I do not know ruby enough to know where I can find the query to rewrite it.

This was the query but projects.id is not in the group by

SELECT t.* FROM (SELECT ROW_NUMBER() OVER(ORDER BY [projects].id) AS _row_num,
[lft], COUNT([lft]) FROM [projects] GROUP BY [lft]
HAVING COUNT([lft]) > 1) AS t WHERE t._row_num BETWEEN 1 AND 1