Modify sql for work history table