I’m trying to run the following query (complex b/c I’m trying to parse out the FileDir from the file field. However, its not getting run because there is an } in the query and this is causing the query to stop running. Any Suggestions?
{exp:query sql="select
t1.title as title,
concat(url,substring(d.field_id_44,LOCATE('}',d.field_id_44)+1)) as img,
t1.url_title as url_title,count(parent_entry_id) as count from exp_channel_titles as t1
join exp_playa_relationships as r on t1.entry_id = r.child_entry_id
join exp_channel_data as d on d.entry_id = t1.entry_id
join exp_upload_prefs as p on (select substring(d.field_id_44,10,LOCATE('}',field_id_44)-10)) = p.id
where t1.channel_id = 8
group by t1.title
order by count desc
limit 5"}