2

Ive got 2 tables:

States
Roads

Each of them contains geometry column.

How can I write a query to show all roads that crosses state x ? It would be something with stintersects but I don't know how to:

geom.StIntersects(any object from states)

Thank You for any help

2 Answers 2

1
SELECT * FROM Roads
WHERE Roads.geo.STIntersects(
    (SELECT geo FROM States WHERE Name = 'x')
) = 1
Sign up to request clarification or add additional context in comments.

2 Comments

That checks all roads against just one state?
That seems to have been the request: "How can I write a query to show all roads that crosses state x ?"
0

Something like this?

Select
  *
From
  Roads
Inner join
  States
    On roads.geomField.stintersects(states.geomField)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.