Order by custom date field

I found the following solution:

SELECT wposts . *
            FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
            WHERE wposts.ID = wpostmeta.post_id
            AND wpostmeta.meta_key =  'datum'
            AND wposts.post_type="optredens"
            AND wposts.post_status="publish"
            ORDER BY wpostmeta.meta_value ASC 

As other query_posts() methods / alternatives did not work very well.

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