Fix Sugar SQL queries

I decided to spend a little time today seeing if I could fix the queries described in one of my previous posts. The error affects Contacts, Accounts, Bug Tracker and Projects when an item is opened. The item displays and would normally show the related items below it, but instead shows an ugly SQL error like this one:

Error running count query for Project List: Query Failed:( SELECT count(*) FROM project_task where ( project_task.parent_id= 'c953abd5-f20c-c84f-7e2d-430101ed6ec9' AND project_task.deleted=0) AND project_task.deleted=0 )::MySQL error 1064: You have an error in your SQL syntax near '( SELECT count(*) FROM project_task where ( project_task.parent_id= 'c953abd5-f' at line 1

The error text (and source query) are longer for entities with more related items possible, since each expected block would have another union strung on to it. I expect that this is because of some incompatibility between versions of MySQL, and I am trying to use an older version than the required 4.0. I would guess that this is valid SQL but just not working in versions prior to 4; I recall that MySQL has fairly recently added some SQL features such as subqueries and unions. A little more investigating of MySQL docs shows that this is correct, the UNION operator was added in MySQL version 4.

So, it looks like I am probably wasting time trying to debug and fix SQL queries that are not really wrong just incompatible. My choices:
upgrading MySQL - creating potential problems with Plesk and other apps
change servers - move to new server with less impact on other apps, or possible older server
downgrade to Sugar with backups and run better but still with some possible db errors

There is really too much possible impact on customers for the first to be an option. I'll have to think about the others.