Query posts by category AND custom field, then ORDERBY another custom field – help!

I ran your query on my local workstation. It looks like there is a typo:

You should have $wpdb->postmeta.meta_value not $wpdb->wpostmeta.meta_value (used twice).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)