Skip to content

Instantly share code, notes, and snippets.

@fuzzysteve
Last active December 31, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuzzysteve/7914509 to your computer and use it in GitHub Desktop.
Save fuzzysteve/7914509 to your computer and use it in GitHub Desktop.
Generate how many stars are within 4.3ly of each system in kspace. (hence the -0.99 restriction)
select solarsystemid,sum(local) from (select mss1.solarsystemid,if(sqrt(pow(mss1.x-mss2.x,2)+pow(mss1.y-mss2.y,2)+pow(mss1.z-mss2.z,2))<4.06802721e16,1,0) local from mapSolarSystems mss1 join mapSolarSystems mss2 on (mss1.solarsystemid != mss2.solarsystemid) where mss1.security!=-0.99 and mss2.security!=-0.99) it group by solarsystemid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment