Drupal 7 - Extract posts and user names
Can I ask why you are not using views for this task?

Views 3 for drupal 7 is a powerful interactive SQL builder. And trivial tasks like this are can be easily sold without even knowing SQL or which tables to join on etc.