Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2008 > SQL Server 2008
|
SQL Server 2008 General discussion of SQL Server *2008* version only - not related to a specific book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 17th, 2012, 05:32 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default Puzzled select statement...

Hi to all...

I have a simple select statement that's puzzled me...

From query analyzer i'm accessing AS400 DB

SELECT ASNUM,ASNAME,BYRNUM,BYRNAM
FROM
AS4001.HARTMMS.MM750LIB.TBLBYR,AS4001.HARTMMS.MM75 0LIB.APSUPP
where TBLBYR.BYRNUM = APSUPP.BYRNUM

i'm getting an error
Server: Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "TBLBYR.BYRNUM" could not be bound.
Server: Msg 4104, Level 16, State 1, Line 4
The multi-part identifier "APSUPP.BYRNUM" could not be bound.

can someone help please...

thanking you in advance...

Rino
 
Old February 18th, 2012, 01:02 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there
try this one instead:

[code]
SELECT ASNUM,ASNAME,BYRNUM,BYRNAM
FROM
AS4001.HARTMMS.MM750LIB.TBLBYR x,AS4001.HARTMMS.MM750LIB.APSUPP y
where x.BYRNUM = y.BYRNUM
[code]
__________________
happy every time, happy every where

Reza Baiat
The Following User Says Thank You to irProject For This Useful Post:
RinoDM (February 20th, 2012)
 
Old February 20th, 2012, 03:53 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default

WOW
thank you very much

it worked???

But why, isn't the same thing...

thank you in-advance

Rino
 
Old February 21st, 2012, 04:08 PM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi again

your statements will work fine but if completed:

Code:
SELECT ASNUM,ASNAME,BYRNUM,BYRNAM
FROM
AS4001.HARTMMS.MM750LIB.TBLBYR,AS4001.HARTMMS.MM75 0LIB.APSUPP
where AS4001.HARTMMS.MM750LIB.TBLBYR.BYRNUM = AS4001.HARTMMS.MM750LIB.APSUPP.BYRNUM
you have used two parts of full field address:
you had wrote:
Code:
where TBLBYR.BYRNUM = APSUPP.BYRNUM
instead of:
Code:
where AS4001.HARTMMS.MM750LIB.TBLBYR.BYRNUM = AS4001.HARTMMS.MM750LIB.APSUPP.BYRNUM
I just tried to assign an alias to long-path-fieldname

Cheers
__________________
happy every time, happy every where

Reza Baiat
The Following User Says Thank You to irProject For This Useful Post:
RinoDM (March 20th, 2012)





Similar Threads
Thread Thread Starter Forum Replies Last Post
select statement ??? RinoDM SQL Server 2000 7 June 19th, 2008 08:40 AM
Chapter 2 ThemeSelector - Puzzled Porjung BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 11th, 2007 07:43 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
puzzled with tomcat5.5.9 Edward King Apache Tomcat 1 September 21st, 2005 02:00 AM
select statement collie MySQL 0 January 14th, 2004 04:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.