Solved

SQL - joining 2 tables

Posted on 2014-01-04
1
212 Views
Last Modified: 2014-01-05
We are trying to set up a SmartList Builder (and roll down to smartlist) a file to send to our CPA's for the 1099's.  I was doing fine until I have a view that has no common fields with the 2nd view.  How do I join the following into 1 view? NOTE: the address in the 1st view is the company address and the address in the 2nd view is the vendor's address.

select LOCATNNM, ADRCNTCT, ADDRESS1, ADDRESS2, CITY, STATE, ZIPCODE, ADRSCODE
from SY00600
where LOCATNID = 'main'

select VENDORID, VENDNAME, TXIDNMBR, ADDRESS1, ADDRESS2, ADDRESS3, CITY, STATE, ZIPCODE, TEN99BOXNUMBER
from PM00200
where VENDORID like 'v%'and VNDCLSID like '1099%'and TEN99BOXNUMBER = '7'
0
Comment
Question by:pstre
1 Comment
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39756876
how would you join the two tables if there is no common field? That's a logical impossibility. What is the relationship between these two tables?

If there is no relationship, perhaps you want to UNION the tables.

For example

SELECT color from T1
red
green
blue


SELECT color from t2
orange
purple
black

SELECT color from t1 UNION SELECT color from t2
red
green
blue
orange
purple
black
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now