I'm learning postgresql and I can't figure out how to write this nested query or if it's even possible.
Table -> Points: pid | val
Table -> Grid: gid | max_val | min_val
Return I want: pid | gid | val
This is how I see it in my head
for p in (SELECT * FROM Points)
SELECT gid FROM Grid AS g WHERE p.val < g.max_val AND p.val > g.min_val
Is this possible? If so can someone point me in the right direction?