Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 The multi-part identifier could not be bound.

Author  Topic 

okjam
Starting Member

4 Posts

Posted - 2012-04-23 : 11:35:17
I am having problems with the below code and ge the error; The multi-part identifier could not be bound.
I just cant see where im going wrong! :)
Any help would be appreciated.
The error is just with the bottom line, syntax says its OK but i am stuck!
Any help appreciated.
Thanks


SELECT
No_ AS [No.],
[Description] AS [Description],
[Standard Cost] AS [Price],
[Vendor No_] AS [Vendor],
[Stores] AS [Stores]
FROM DATABASE$Item
INNER JOIN
(
SELECT
[Item No_] AS [Item No_],
SUM([Remaining Quantity]) AS [Stores]
FROM
[DATABASE$Item Entry]
WHERE
[Location Code] = 'STORES'
GROUP BY
[Item No_]
) AS Inv
ON
Item.No_ = [Item Entry].[Item No_]

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-23 : 11:38:48
where are these columns coming from?
[Description] AS [Description],
[Standard Cost] AS [Price],
[Vendor No_]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

okjam
Starting Member

4 Posts

Posted - 2012-04-23 : 11:41:01
I have 2 Tables.

1 Is DATABASE$Item
1 is DATABASE$Item Entry

Item = Item information
Item Entry = Ledger of transactions

So what i want to do is join the SUM OF remaining to the current table so i can have item info + inventory (SUM OF remaning from Item entry)
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-23 : 11:41:25
It is looking for a table or table alias with the name Item_Entry. So one of these perhaps?
SELECT No_ AS [No.],
[Description] AS [Description],
[Standard Cost] AS [Price],
[Vendor No_] AS [Vendor],
[Stores] AS [Stores]
FROM DATABASE$Item AS Item_Entry
INNER JOIN (
SELECT [Item No_] AS [Item No_],
SUM([Remaining Quantity]) AS [Stores]
FROM [DATABASE%Item Entry]
WHERE [Location Code] = 'STORES'
GROUP BY
[Item No_]
) AS Inv
ON Inv.Item.No_ = [Item Entry].[Item No_]
OR
SELECT No_ AS [No.],
[Description] AS [Description],
[Standard Cost] AS [Price],
[Vendor No_] AS [Vendor],
[Stores] AS [Stores]
FROM DATABASE$Item
INNER JOIN (
SELECT [Item No_] AS [Item No_],
SUM([Remaining Quantity]) AS [Stores]
FROM [DATABASE%Item Entry]
WHERE [Location Code] = 'STORES'
GROUP BY
[Item No_]
) AS Inv
ON DATABASE$Item.Item.No_ = Inv.[Item No_]
Also,a re your tables really named DATABASE%Item Entry, DATABASE$Item etc.? That is somewhat unusual naming convention for SQL server tables.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-23 : 11:43:23
quote:
Originally posted by okjam

I have 2 Tables.

1 Is DATABASE$Item
1 is DATABASE$Item Entry

Item = Item information
Item Entry = Ledger of transactions

So what i want to do is join the SUM OF remaining to the current table so i can have item info + inventory (SUM OF remaning from Item entry)


nope my question was which table contains below columns?

[Description] AS [Description],
[Standard Cost] AS [Price],
[Vendor No_]

is it DATABASE$Item or DATABASE$ItemEntry?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

okjam
Starting Member

4 Posts

Posted - 2012-04-23 : 11:44:15
Sorry Visakh,
Those columns are on DATABASE$Item

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-23 : 11:46:02
Ok..then Sunita's explanation should be solution

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

okjam
Starting Member

4 Posts

Posted - 2012-04-23 : 11:49:06
It did!
Thanks :D
Go to Top of Page
   

- Advertisement -