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]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to