I have two tables: Equipments and EquuipAssign. I add a customfield to the table EquuipAssin. The expression for the customfield is:
SELECT *, (SELECT Administrator FROM Equipments WHERE ID=EquuipAssign.EquipID) As Administrator FROM EquuipAssign
But there is an error message that the expression is wrong. I don’t know why. Is there any suggestion?
The expression of your custom field “Administrator” should be:SELECT Administrator FROM Equipments WHERE ID=EquuipAssign.EquipIDand not:SELECT *, (SELECT Administrator FROM Equipments WHERE ID=EquuipAssign.EquipID) As Administrator FROM EquuipAssign
Thank you for suggestion, but there is still same error"Failed to add Custom Field. #42000 You have an error in SQL syntax…". But in the database manager (phpMyAdmin) the result for “SELECT (SELECT Administrator FROM Equipments WHERE ID=EquuipAssign.EquipID) As Administrator FROM EquuipAssign” is correct.
greyman wrote:
Failed to add Custom Field. #42000 You have an error in SQL syntax…".What is the error in SQL syntax?You may post the CREATE TABLE of the Equipments and EquuipAssign tables so other users can test.