select table1.name, table2.id2+table2.col1+table2.col2+table2.col3 as mysumresult from table1 left join reference using (id1) left join table2 using (id2);

[EMAIL PROTECTED] wrote:

Not sure my other email got through, so here it is again, with an updated
description of the problem.

Hi,

I have a database with 3 names in it. In each of these names is 5
categories that have numbers in them. I want to be able to do a select and
total these numbers for each name, and then sort them in descending order. I
have tried for over 6 hours tonight and no matter what I do, there is one
minor glitch. I am not supplying any code as I would like to know from you
people first what the best way to go about this would be - as what I have
done is
obviously not working.

TIA

i.e

This is what is in the database.

Table 1

ID1 NAME

1 Bill
2 John
3 Fred

Table 2

ID2 Col1 Col2 Col3 Col4

1 1 4 5 6
2 3 2 8 6
3 4 9 2 2

Database 3 is a reference file that ties them together - so I would have to
use a join in the select statement.

ID1 ID2
1 1
2 2
3 3

This is what I want to be able to show:

John 21
Fred 20
Bill 16





























sql, query, queries, smallint



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


--
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/



---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to