Retrieving the details is relatively simple. Rendering the the resultant SQL in a usable form, however, isn't.