You can certainly query directly Query_History and get the desired details or you can make use of the dedicated Information Schema table functions(QUERY_HISTORY_BY_* ) associated with it.