Error calculating the number of related records
Posted: Tue Jun 15, 2010 4:13 am
Hello,
first of all thanks a lot for the work on this tool which really eases a good part of our daily data handling. Keep up the great work!
I have a table #1 which has a relationship with table #3 through the junction table #2 (many to many).
It's defined in my relationships.ini by
As for the display of the relationship all works fine (and even deeper ramifications i.e. table3 relates to table5 through table4 and so on are correctly displayed in the relationship tree on the left) but when it gets to removing or updating the relationship XF comes up with the following error message:
The query should work fine when it would have "... AND `table3`.`id` = '1'" instead of "... AND `id` = '1'" at the end. But how do I update/tell XF to perform the right query?
Thanks a lot for your hints/help! Cheers, Nik
first of all thanks a lot for the work on this tool which really eases a good part of our daily data handling. Keep up the great work!
I have a table #1 which has a relationship with table #3 through the junction table #2 (many to many).
It's defined in my relationships.ini by
- Code: Select all
__sql__ = "SELECT `table_3_column` FROM `table3` INNER JOIN `table2` ON (`table2.table3_id` = `table3.id`) WHERE `table2.table1_id` = '$id'"
As for the display of the relationship all works fine (and even deeper ramifications i.e. table3 relates to table5 through table4 and so on are correctly displayed in the relationship tree on the left) but when it gets to removing or updating the relationship XF comes up with the following error message:
- Code: Select all
Fatal error: Error calculating the number of related records there are for the relationship 'Region' in the table 'table1'. There was a problem performing the sql query 'SELECT COUNT(*) as num from `table3` INNER join `table2` on (`table2`.`table3_id` = `table3`.`id`) where `table2`.`table1_id` = '2' and `id` = '1''. The MYSQL error returned was 'Column 'id' in where clause is ambiguous'.
The query should work fine when it would have "... AND `table3`.`id` = '1'" instead of "... AND `id` = '1'" at the end. But how do I update/tell XF to perform the right query?
Thanks a lot for your hints/help! Cheers, Nik