在属性上加入客户

I'm trying to filter my orders which are returned back by the magento API by a customer attribute. I tried several approaches but nothing seem to work.

I'm using Magento 1.4.1.1 atm and the api does this at the moment:

$billingAliasName = 'billing_o_a';
$shippingAliasName = 'shipping_o_a';


    $collection = Mage::getModel("sales/order")->getCollection()
        ->addAttributeToSelect('*')
        ->addAddressFields()
        ->addExpressionFieldToSelect(
            'billing_firstname', "{{billing_firstname}}", array('billing_firstname'=>"$billingAliasName.firstname")
        )
        ->addExpressionFieldToSelect(
            'billing_lastname', "{{billing_lastname}}", array('billing_lastname'=>"$billingAliasName.lastname")
        )
        ->addExpressionFieldToSelect(
            'shipping_firstname', "{{shipping_firstname}}", array('shipping_firstname'=>"$shippingAliasName.firstname")
        )
        ->addExpressionFieldToSelect(
            'shipping_lastname', "{{shipping_lastname}}", array('shipping_lastname'=>"$shippingAliasName.lastname")
        )
        ->addExpressionFieldToSelect(
                'billing_name',
                "CONCAT({{billing_firstname}}, ' ', {{billing_lastname}})",
                array('billing_firstname'=>"$billingAliasName.firstname", 'billing_lastname'=>"$billingAliasName.lastname")
        )
        ->addExpressionFieldToSelect(
                'shipping_name',
                'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
                array('shipping_firstname'=>"$shippingAliasName.firstname", 'shipping_lastname'=>"$shippingAliasName.lastname")
        );

Which is the default API call I guess. Now I just want to join a customer attribute called update - how do I achieve this simple task?

Or is this not possible on a flat table like sales_flat_order?

Whenever I need to do this I use something like:
Joining An EAV Table (With Attributes) To A Flat Table

It's not well optimised but you should be able to pick out the parts you need.

PS.
I think I'll explain what I mean by optimised since it's important. In the heart of the method is this bit:

->joinLeft(array($alias => $table),
    'main_table.'.$mainTableForeignKey.' = '.$alias.'.entity_id and '.$alias.'.attribute_id = '.$attribute->getAttributeId(),
    array($attribute->getAttributeCode() => $field)
);

If you know MySQL then you'll know it will only pick one index when joining a table, the more specific the better. In this case only the entity_id and attribute_id fields are being used so MySQL is restricted to those. Both columns are indexed but the cardinality is low.

If the condition also included the entity type then MySQL would have the choice of using IDX_BASE which indexes the columns entity_type_id,entity_id,attribute_id,store_id in that order (it needs to process them left to right). So something like this results in a much improved EAV performance - depending on how many rows on the 'left' table it could be several hundred- or thousand-fold better.

$alias.'.entity_type_id='.$entityType->getId().' AND main_table.'.$mainTableForeignKey.' = '.$alias.'.entity_id AND '.$alias.'.attribute_id = '.$attribute->getAttributeId().' AND '.$alias.'.store_id=0'