Here's a shorter, better way to describe the problem I want to solve. Given an arbitrary SQL query, I would like to know: 1. The name of the columns that will be returned if I execute the query 2. For each of those returned columns, did it come from a specific column in a specific table? If so, which one? 3. If a column was generated by an expression (a group_concat() for example) I'm OK not knowing which columns from which table were involved in that expression Ideally I'd like to do this without executing the query (or while executing the query with a limit 0) but I'd be OK with a solution that did execute the query too.