SQL now works with the current DB design. (hopefully)