Q:

Adding Node-Fields to query with db_select();

I am building a query using db_select(); Now I need to sort my result by a field that a added using fields. Is there some nicer way than to join field_data_field_fieldname, and revision? 
I was hoping for something like $query->addFieldData("field_foo", "myfoo"); so i can simply $query->orderBy('myfoo', 'asc');
I am also wondering why there is no example in the API that joins node-fields.

A:

To my knowledge, db_select() isn't aware of entities or fields (fields, in the context of field that are added to nodes etc.)
I imagine you'd need to do the joins to field tables yourself. I found a little example from dbtng_example--dbtng_example.module, but as per my hunch and comments below - EntityFieldQuery is actually the only correct way to do this. Fields can define their own storage which would completely break your db_select, so...
With a bit of a performance hit (which is negligible for most) you really should do it the Drupal 7 way...
Drupal 7 now has Fields in core, and with that came the EntityFieldQuery which is a querying class for finding entities (like nodes, terms, etc) by their properties (like published status) or fields (like field_page_photo or any other fields you add via UI or otherwise)
or from API:

This class allows finding entities
  based on entity properties (for
  example, node->changed), field values,
  and generic entity meta data (bundle,
  entity type, entity id, and revision
  ID).

Some good examples and discussion here:
What's the proper use of EntityFieldQuery?
and I find myself referencing Do we need an EntityFieldQuery example? as well.

