Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.50 KB | None | 0 0
  1. SELECT hp.name AS home, dp.name AS destination, sm.START,
  2.        SQRT(pow(ds.position_x - hs.position_x, 2) +
  3.             pow(ds.position_y - hs.position_y, 2) +
  4.             pow(ds.position_z - hs.position_z, 2)) FROM
  5.     space_missions AS sm
  6.         INNER JOIN planets AS hp ON sm.home_planet_id=hp.id AND sm.START > '2040-01-01'
  7.             LEFT JOIN stars AS hs ON hp.star_id = hs.id
  8.         LEFT JOIN planets AS dp ON sm.dest_planet_id=dp.id
  9.             LEFT JOIN stars AS ds ON dp.star_id = ds.id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement