Mysql::Error: Unknown column 'pl.id' in 'on clause': select pe.id as person_id, pl.name as player_name, pl.id as id, pl.className as class_name, ranks.name as rank_name, (case when num_raids.raid_count is not null then num_raids.raid_count else 0 end) as raid_count , (earned.dkp_earned_14 - case when spent.dkp_spent_14 is not null then spent.dkp_spent_14 else 0 end) as dkp_14, (earned.dkp_earned_17 - case when spent.dkp_spent_17 is not null then spent.dkp_spent_17 else 0 end) as dkp_17, (earned.dkp_earned_16 - case when spent.dkp_spent_16 is not null then spent.dkp_spent_16 else 0 end) as dkp_16, (earned.dkp_earned_11 - case when spent.dkp_spent_11 is not null then spent.dkp_spent_11 else 0 end) as dkp_11, (earned.dkp_earned_19 - case when spent.dkp_spent_19 is not null then spent.dkp_spent_19 else 0 end) as dkp_19, (earned.dkp_earned_18 - case when spent.dkp_spent_18 is not null then spent.dkp_spent_18 else 0 end) as dkp_18, (earned.dkp_earned_10 - case when spent.dkp_spent_10 is not null then spent.dkp_spent_10 else 0 end) as dkp_10 from players pl, people pe,