title: How can I do this Spatial Query in Sql 2008?
body: <p>i'm trying to do a spatial query in sql 2008 -> for a given list of POI's (point of interest, long/lat <code>GEOGRAPHY</code> data), which postcodes do they exist in (multipolygon <code>GEOGRAPHY</code> data).</p>
  
  <p>So this is the query i tried, but it's syntactically incorrect:-</p>
  
  <pre><code>SELECT PostCodeId, ShapeFile
  FROM Postcodes a
  WHERE a.ShapeFile.STIntersects(
      SELECT PointOfInterest
      FROM PointOfInterests
      WHERE PointOfInterestId IN (SELECT Item from dbo.fnSplit(@PoiIdList, ','))
  </code></pre>
  
  <p>So this means i pass in a <a href="https://stackoverflow.com/questions/337704/parameterizing-a-sql-in-clause">csv list of POI Id's and split them</a>. That's not a problem .. it's my subquery in the <code>STIntersects</code>. That's invalid.</p>
  
  <p>So .. any suggestions folks?</p>