Numerous SQL snippets to reference for pulling data straight from Magento's database.
All SQL snippets assume there is no database table name prefix configured. In the event that your database does have a table nameprefix, you should be able to simply update the original table names found in the "FROM" and "LEFT JOIN" declarations. All table names are aliased therefore a full revision of the SQL snippets would not be necessary.