modify a mysql "show" command? How do I write a query which takes the data from a "show" query and manipulate it?

In this specific instance, I need just one of the fields from "show slave status".

How do I do this?


  SELECT Slave_IO_State FROM (show slave status);


OR, how do I find out the underlying query for a "show" type command? I vaguely recall doing this in the past, but can't find any reference to it. Possibly an option in the mysql client? I tried logging the queries run, but that just showed the "show slave status".
I think you cannot use the result of SHOW commands as if they were tables. You can, however use the Performance Schema Replication Tables.

To get the Slave_IO_State, you have to take into account the following remarK.


  The Slave_IO_State and Slave_SQL_Running_State fields are not preserved. If needed, these values can be obtained from the process list by using the THREAD_ID column of the appropriate replication table and joining it with the ID column in the INFORMATION_SCHEMA PROCESSLIST table to select the STATE column of the latter table.