it is probably best to run a custom query using a wordpress DB object. (from functions.php file or theme file, etc.):
// pseudo-code check how to refer to the field columns and table name! global $wpdb; $sql="SELECT id, title FROM posts"; $posts = $wpdb->get_results($sql); print("<ul>"); foreach ($posts as $post) { print('<li>'.$post->FIELD1.'|'.$post->FIELD2.'<br/>'); print('</li>'); } print("</ul>");
I think that in fact you can get this also with the standard wp_query object .... but at least my way is to first execute the request in phpmyadmin and then configure the / wordpress syntax prefix. (read the code on the database object). If it is one-time, just use phpmyadmin, but for programmatic use you have to convert it to run from the functions.php file.
source share