Skip to content

Instantly share code, notes, and snippets.

@jjb
Forked from Felienne/gist:cc6ad6116bb4342c3fe0
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjb/06e814a356b0f66a7c5a to your computer and use it in GitHub Desktop.
Save jjb/06e814a356b0f66a7c5a to your computer and use it in GitHub Desktop.
Match (C:Cell) <- [*1..2] – (p:Cell) return c,p
SELECT dbo.CellInRange.cellID, dbo.precedents_range.cellID as PrecID
FROM dbo.Cells as CellsInRange
INNER JOIN
dbo.precedents_range ON CellsInRange.Id = dbo.precedents_range.cellID
INNER JOIN
dbo.Range ON dbo.precedents_range.rangeID = dbo.Range.Id
INER JOIN
Dbo.CellInRange ON dbo.Range.Id = dbo.CellinRange.rangeID
UNION
SELECT dbo.Cells.Id as CellId, dbo.precedents.precId as PrecId
FROM dbo.Cells
INNER JOIN
dbo.precedents ON dbo.Cells.Id = dbo.precedents.cellId
INNER JOIN
Dbo.Cells as PrecedentsCells ON dbo.precedents.precId = precedentsCells.Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment