Added MySQL retrieve thread query