Solved

SQL - joining 2 tables

Posted on 2014-01-04
1
207 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

763 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