Topic: Calculated fields

Hi, every body
Please can someone provide me with examples of databases with simple and complex calculated fields.
Thanks

Re: Calculated fields

Simple, Sum.

tablename.fieldname1 + tablename.fieldname2

Complex calculated field for "tablename1" table name. How many every parent record has child records

(SELECT COUNT(tablename2.id) FROM tablename2 WHERE  tablename2.id_tablename1 = tablename1.id)
Dmitry.

3 (edited by ljhurtado 2019-02-11 22:15:19)

Re: Calculated fields

Thank you. But I have a problem.
I need to create a calculated field that contains calculated fields from the same table and another table. I write this script but it does not work.

 (1-(SELECT Muro.constante FROM Muro,Sala WHERE Muro.id = Sala.id_Muro)* Sala.TotalMaterialMuro) 
Post's attachments

Attachment icon error.png 108.73 kb, 138 downloads since 2019-02-11 

Re: Calculated fields

You can't use calculated field name in another calculated field, instead you must write SQL query again, like this

(tablename.fieldname1 + tablename.fieldname2) + (SELECT COUNT(tablename2.id) FROM tablename2 WHERE  tablename2.id_tablename1 = tablename1.id)
Dmitry.

Re: Calculated fields

Thanks