Sugar
SELECT *,CONVERT(REPLACE(REPLACE(minp.meta_value,'£',''),',',''),UNSIGNED INTEGER) Price, CASE WHEN minp.meta_value = 'POA' THEN '1' WHEN minp.meta_value != 'POA' THEN '2' END as `mainsort` FROM wp_posts p inner join wp_postmeta minp on minp.post_id = p.Id and CONVERT(REPLACE(REPLACE(minp.meta_value,'£',''),',',''),UNSIGNED INTEGER) >= CONVERT('',UNSIGNED INTEGER) and minp.meta_key = 'cp_price' inner join wp_term_relationships tr on tr.object_id = p.Id and tr.term_taxonomy_id =9 WHERE ID not in (62293) and post_status='publish' and post_type='post' and (post_title LIKE '%%' or post_content like '%%') ORDER BY `mainsort` , CONVERT(REPLACE(REPLACE(minp.meta_value,'£',''),',',''),UNSIGNED INTEGER) desc