Fix data query joins for certain values