Hi,
I hope this is the right forum for this question. If not, I'm happy to get some tip on where to post this.

My problem:
I have like 20 tables of data and need to merge these, making a selection, (and dump it into a text file) to import into a reporting tool. The tables is like salesrep, value of sales, number of customers, and som series of codes. If I do a JOIN, I only get the salesreps that exist in that specific table, but new people are added and some have left the company. How can this be done??


A short example of the data:

Table_1998:
empl_id | sales98 | customers98 | etc98 | ...
   1001 |   12659 |         123 | ffff  | ...
   1002 |  103674 |         597 | hued  | ...
   1003 |   23589 |         314 | hjeoir| ...

Table_1999:
empl_id | sales99 | customers99 | etc99 | ...
   1001 |   35678 |         213 | dwrer | ...
   1002 |  125795 |         603 | freui | ...
   1003 |   45678 |         343 | hfiwu | ...
   1004 |    8753 |          96 | poijo | ...

Table_2000:
empl_id | sales00 | customers00 | etc00 | ...
   1001 |   97361 |         526 | urhfn | ...
   1003 |   98716 |         649 | jdwoh | ...
   1004 |   15872 |         147 | oijnm | ...

Now I try to get the customersXX columns for every emloyee from these tables.
What I would like to see in my result:
empl_id | customers98 | customers99 | customers00 | ...
   1001 |         123 |         213 |         526 | ...
   1002 |         597 |         603 |        NULL | ...
   1003 |         314 |         343 |         649 | ...
   1004 |        NULL |          96 |         147 | ...


I've tried everything and I'm out of clues.
Can it be done?? If so, how???

Any help/tips are very welcome!!

/Johan, Uppsala - Sweden

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

Reply via email to