calculative field

must have a field where user defined sql may be used to retreave data or formulas may be applied

wouldnt this be a massive security risk?

I think that something similar to your request has been developed.

I haven’t tried it myself but you can have a look here:

https://github.com/audoxcl/SugarCRMCustomQueries

Please post back after you try it to share with others.

PS: I agree with Darren on the potential security risks