Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL - joining 2 tables

Posted on 2014-01-04
1
Medium Priority
?
235 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

609 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