Database Error; SQL: SELECT
DISTINCT
CASE
WHEN `loyer_decote`.`meta_value` IS NOT NULL AND `loyer_decote`.`meta_value` != 0 THEN `loyer_decote`.`meta_value`
ELSE `loyer_hors_charge`.`meta_value`
END as loyer,
t.*
FROM `wp28401_posts` AS `t`
LEFT JOIN `wp28401_postmeta` AS `loyer_decote` ON
`loyer_decote`.`meta_key` = 'loyer_decote'
AND `loyer_decote`.`post_id` = `t`.`ID`
LEFT JOIN `wp28401_postmeta` AS `loyer_hors_charge` ON
`loyer_hors_charge`.`meta_key` = 'loyer_hors_charge'
AND `loyer_hors_charge`.`post_id` = `t`.`ID`
LEFT JOIN `wp28401_postmeta` AS `type_dannonce` ON
`type_dannonce`.`meta_key` = 'type_dannonce'
AND `type_dannonce`.`post_id` = `t`.`ID`
LEFT JOIN `wp28401_postmeta` AS `typologie` ON
`typologie`.`meta_key` = 'typologie'
AND `typologie`.`post_id` = `t`.`ID`
WHERE ( ( `type_dannonce`.`meta_value` = 'Louer' ) AND ( `t`.`post_type` = "annonce" ) AND ( `t`.`post_status` IN ( "publish" ) ) )
ORDER BY CAST(loyer%20AS%20DECIMAL(10,2))%20ASC,%20CAST(`typologie`.`meta_value`%20AS%20DECIMAL(10,2))%20DESC, `t`.`menu_order`, `t`.`post_title`, `t`.`post_date`
LIMIT 72, 12; Response: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')%20ASC,%20CAST(`typologie`.`meta_value`%20AS%20DECIMAL(10,2))%20DESC, `t`.`menu' at line 34