Re: Specifics on using join & multiple tables

2003-06-05 Thread Jose Miguel PĂ©rez
Hi Patrick! > I need: > > acc.name, acc.phone, acc.acctno, sales1.amt as mo1sales, sales2.amt as > mo2sales, (sales1.amt - sales2.amt) as diff SORT by diff > > I need all data in sales1 and sales2, but only for records from > acc that are in either/both sales1, sales2. > > I tried: > select f

Re: Specifics on using join & multiple tables

2003-06-05 Thread Bruce Feist
Patrick Shoaf wrote: At 09:48 AM 6/4/2003, Bruce Feist wrote: I suspect that sales1 and sales2 should really be a single 'sales' table with an extra column indicating which month the sales are for (and maybe one for year as well), but I don't have enough information to be sure. Table sales1 & sa

Re: Specifics on using join & multiple tables

2003-06-05 Thread Patrick Shoaf
At 09:48 AM 6/4/2003, you wrote: Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2003-06-04 09:17:01 -0400: I need all data in sales1 and sales2, but only for records from acc that are in either/both sales1, sales2. SELECT acc.name, acc.phone, acc.acctno, sales1.amt AS mo1sales, sale

Re: Specifics on using join & multiple tables

2003-06-04 Thread Bruce Feist
Roman Neuhauser wrote: # [EMAIL PROTECTED] / 2003-06-04 09:17:01 -0400: I need all data in sales1 and sales2, but only for records from acc that are in either/both sales1, sales2. SELECT acc.name, acc.phone, acc.acctno, sales1.amt AS mo1sales, sales2.amt AS mo2sales,

Re: Specifics on using join & multiple tables

2003-06-04 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2003-06-04 09:17:01 -0400: > acc.name, acc.phone, acc.acctno, sales1.amt as mo1sales, sales2.amt as > mo2sales, (sales1.amt - sales2.amt) as diff SORT by diff > > I need all data in sales1 and sales2, but only for records from acc that > are in either/both sales1, sales2. >

Specifics on using join & multiple tables

2003-06-04 Thread Patrick Shoaf
I am fairly new to MySQL and SQL in general. I have three tables, acc,sales1,sales2. All have acctno in common. acc is general customer table with lots of information. sales1 is a generated table of sales for specific customer from a given month/year. sales2 is the sale as sales1 except for