Hi Robert, the criteria for the record_1 and record_15 is that both are in the same table, but in different records and to find each one it is necessary to perform a WHERE clause.
Let's I give you the real example: My problem is while inserting a new record in my table named "ScanQuantification", I will need to update another table named "Scan", IF a value from the field "ScanQuantificationValue" from table "ScanQuantification" is equal or greater than a "calculate value". The "calculate value" comes from this formula: ( ( A + B ) / 2 + C) where: A is a value find from the field "ScanQuantificationValue" from table "ScanQuantification" where the "TimePoint" = 8 B is a value find from the field "ScanQuantificationValue" from table "ScanQuantification" where the "TimePoint" = 9 C is a value find from the field "TrialBaseValue" from table "Trial" This is easy to do using the PHP language. However I will have different Trials and each one has different "formula". That's why I want to put the SELECT to work for me. Thanks Andre On Fri, 30 Apr 2004, Robert J Taylor wrote: > Andre MATOS wrote: > > >Hi, > > > >Is it possible to create a Select performing a math formula? For example: > > > >First I need to add two values come from the same table but from different > >records. The result will be divided from one number got from another > >table. Now, the new result will be added with another value got from > >another table creating the final result. Like this: > > > >((value_from_record_1_from_table_A + value_from_record_15_from_table_A) / > >value_from_table_B ) + value_from_table_C > > > > > > > Not knowing what the criteria for selecting the different "records" from > table_A (1 and 15), I'll forgo a join clause and just illustrate a > simple alias with where clause: > > SELECT (( a1.value + a2.value ) / b.value ) + c.value AS final_result > FROM > table_A a1, table_A a2, table_B b, table_C c > WHERE > a1.key = 1 AND a2.key = 15 AND > /* guessing here */ > b.key = a1.key AND c.key = a2.key > AND a1.key <> a2.key > AND a2.key IS NOT NULL > AND a1.key IS NOT NULL; > > That's not "correct" as I am guessing your actual criteria, etc., but it > gives the idea. Can you be more specific on the criteria for relating > (joining) tables A, records 1 and 15, with themselves and with tables B > and C? > > >Is this possible? Is there anyone who can help me to create this SELETC? > > > >Thanks. > > > > > > > HTH, > > Robert Taylor > [EMAIL PROTECTED] > > > > -- Andre Matos [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]