SQL adjustment