title: Checking an IP Address against an CIDR range in redshift
body: <p>I've got a problem i have been trying to work out I have googled a few things that are similar to what i want to do but can't work out exactly how to do it, </p>
  
  <p>I have around 250M ip address's and i want to look that up against the maxmind geolite2 data so that i can tell what country each IP-address originates from,</p>
  
  <p>I have imported all the data into my Redshift cluster with talend, </p>
  
  <pre><code>table a has ID and 'ipaddress' ie 10.0.0.5
  table b (maxmind) has country name and IP range as expressed as 10.0.0.0/24
  </code></pre>
  
  <p>how could i use Redshift SQL to match these two considering the size of my source data source?   </p>
  
  <p>edit: heres the link to the geolite2 data <a href="https://dev.maxmind.com/geoip/geoip2/geolite2/" rel="nofollow">https://dev.maxmind.com/geoip/geoip2/geolite2/</a></p>