Custom MySQL Query with logic

Thank’s everyone for your attention.

If anybody will need to query database with two postmeta, here is the code

SELECT p.* 
, CASE WHEN m1.meta_value=0 OR m1.meta_value IS NULL 
THEN m2.meta_value 
ELSE m1.meta_value 
END meta_value 
FROM aka_v_posts p 
LEFT JOIN aka_v_postmeta m1 ON p.id=m1.post_id AND m1.meta_key='_wpsc_special_price' 
LEFT JOIN aka_v_postmeta m2 ON p.id=m2.post_id AND m2.meta_key='_wpsc_price' 
WHERE post_title LIKE '%32%'
AND post_type="wpsc-product" 
ORDER BY aka_v_posts.post_date DESC

The thing to keep in mind (at least I was doing it wrong) is that you need to check for meta_values before the FROM keyword, to select those meta_values.