Solved

SQL - joining 2 tables

Posted on 2014-01-04
1
216 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

815 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

12 Experts available now in Live!

Get 1:1 Help Now