Skip to content

Instantly share code, notes, and snippets.

@Felienne
Created December 11, 2014 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Felienne/cc6ad6116bb4342c3fe0 to your computer and use it in GitHub Desktop.
Save Felienne/cc6ad6116bb4342c3fe0 to your computer and use it in GitHub Desktop.
SQL to Cypher
It was:
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
Now it is:
Match (C:Cell) <- [*1..2] – (p:Cell) return c,p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment