SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 having trouble selecting from 2 tables. Simple sim
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AdamWest
Constraint Violating Yak Guru

USA
357 Posts

Posted - 09/13/2013 :  13:12:12  Show Profile  Reply with Quote
SELECT IDDOCD,IDCOM#, IDPRT#, IDGRC#,
IDENT#,IDSFX#,IDPRLC, IDNTU$, IDSHP#, IDINV# from astdta.oeind94,
SELECT IARCC9 from astdta.icprt1

each select alone is ok. how do you combine these?

James K
Flowing Fount of Yak Knowledge

3742 Posts

Posted - 09/13/2013 :  13:19:51  Show Profile  Reply with Quote
Something like this perhaps? You have to find some relationship between the two tables i.e., some column or columns on which to JOIN them
SELECT 
	IDDOCD,IDCOM#, IDPRT#, IDGRC#, 
IDENT#,IDSFX#,IDPRLC, IDNTU$, IDSHP#, IDINV# , IARCC9
from astdta.oeind94 o 
INNER JOIN astdta.icprt1 i ON i.SomeColumnIn_oeind94 = o.SomeColumnIn_oeind94
Go to Top of Page

AdamWest
Constraint Violating Yak Guru

USA
357 Posts

Posted - 09/13/2013 :  13:22:04  Show Profile  Reply with Quote
I see. OK because I am taking something that the crystal reports makes and trying to apply it on the server. Thanks for the help, James.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/15/2013 :  04:09:02  Show Profile  Reply with Quote
unless you specify a relation what you would end up would be a cartesian product.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000