Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [xpert] calculating a field from other fields: Edit Log

Here is the list of edits for this post
Re: [xpert] calculating a field from other fields
Here's something that may help ya. Assuming you're at the point where you know how to get to the point of feeding mysql a query. $TBL->do_query( "... your query... "); Something that may help you greatly will be an UPDATE query. With it, you can set values on columns on a specific number of records or even do complex mathematical operations on your entire database.

So without furthur ado.

Code:

UPDATE yourtablename
SET
yourfirstcolumnname = 'value that youd like to set specifically or...',
yoursecondcolumnname = ABS(( tax1 + tax2 + tax3 + tax4 + tax5)/5),

... and so on...

Because we haven't put any constraints on that query, it will affect the entire table set. Does that help Angelic

Something that may help you learn SQL code is to use mysqlman or espeically the newest myphpadmin (sinnce it handles functions) and use the query wizards to generate queries andsee what you can get. Even MS Access can show you the low-level sql from their wizards so it makes a good learning tool.

Just a caveat here though, certain functions may not be portable across different sql systems. If it works in mysql, it might not in postgres or msql, etc. Nothing to be concerned about if you're not going to distribute your code

Last edited by:

Aki: Aug 24, 2002, 7:59 PM

Edit Log: