By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,363 Members | 2,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,363 IT Pros & Developers. It's quick & easy.

SELECT data from two tables using same field labeled differently

P: 31
I need to select data from two tables in one statement. The tables do have a common key field, but they're named differently: One is MPPONO and the other is just plain PPONO... Can anybody tell me how to write out the statement?
May 15 '08 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
I need to select data from two tables in one statement. The tables do have a common key field, but they're named differently: One is MPPONO and the other is just plain PPONO... Can anybody tell me how to write out the statement?
The columns that will be used for join as key don't need to have the same name. They only need to have the same data type, or at least can be converted in the same data type.

An expression may also be used in JOIN keys. Search some postings here on the forum and you'll see some good samples.

-- CK
May 15 '08 #2

Delerna
Expert 100+
P: 1,134
Just to illustrate
Expand|Select|Wrap|Line Numbers
  1. SELECT YourFields
  2. FROM TABLE1
  3. JOIN TABLE2 on TABLE1.MPPONO = TABLE2.PPONO
  4.  
May 15 '08 #3

P: 31
Perfect! thanks a lot guys!
May 16 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.