sql select statement for 2 differ tables with unique jobnumber
Posted on 2013-01-14
I have 2 tables from 2 DB on the same server that import seperate items.
DB1 collects Labor for Jobs
DB2 Collects equipment for Jobs
Both tables contain 2 columns ( JobNumber and JobName)
JobNumber in both tables will always have the same JobNumber
Jobname may be not always be exactly the same.
I need to write a SQL query that will display a list of the jobnumbers and a jobname (JobName can come from either table)
Now the table may contain equipment for a job, but no labor, and visa versa.
So the tables may look like this:
JoNu Jobname JoNu JobName
20021 Ellis Apartments 20021 Elis Apartments
20022 510 South Street 20022 Drexel warehouse
20023 Sam's warehouse 20024 Mike's studios
20023 Smas Warehouse 20024 Mikes Studios
I need the query to display to look something like this:
20021 Ellis Apartments
20022 Drexel warehouse (Either or)
20023 Sam's warehouse
20024 Mike's studios
Distinct and inner join are out the window, as distinct will give me (2) 20023
and Inner join will give me no jobs for 20023 and 20024.
Getting them to spell the name of the job the same is out the window too.