?
Solved

SQL - joining 2 tables

Posted on 2014-01-04
1
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 24

Accepted Solution

by:
mankowitz earned 2000 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

777 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