Fixed sql join naming errors
Added condition adding and editing functionality