resorting to concatenating raw SQL strings until better solution is found