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.
| Author |
Topic |
|
rluyinda
Starting Member
3 Posts |
Posted - 2009-05-29 : 05:44:23
|
| Hi am trying to validate that stockm.PHYSICAL_QUANTITY= sum(stkhstm.MOVEMENT_QUANTITY) PER PRODUCTselect Product from dbo_i_stockmwhere dbo_i_stockm.Product = dbo_i_stockhistm.PRODUCTand dbo_i_stockm.PHYSICAL_QTY <> sum(dbo_i_stockhistm.MOVEMENT_QUANTITY);The error msg i get is:Msg 4104, Level 16, State 1, Line 1The multi-part identifier "dbo_i_stockhistm.PRODUCT" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "dbo_i_stockhistm.MOVEMENT_QUANTITY" could not be bound.Thx,Richard Luyinda |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-29 : 05:49:06
|
[code]select dbo_i_stockm.Product from dbo_i_stockm inner join ( select Product, MovnQty = sum(MOVEMENT_QUANTITY) from dbo_i_stockhistm group by Product ) as histm on dbo_i_stockm.Product = histm.Productwhere dbo_i_stockm.PHYSICAL_QTY <> histm.MovnQty [/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-29 : 05:53:03
|
There are so many fundamental errors in your query, so I suggestion you start reading and improve your skills by visiting http://www.w3schools.com/sql/default.asphere is your queryselect a.Productfrom dbo_i_stockm AS ainner join ( SELECT product, sum(MOVEMENT_QUANTITY) AS MOVEMENT_QUANTITY from dbo_i_stockhistm group by product ) AS b ON b.PRODUCT = a.Productwhere a.PHYSICAL_QTY <> b.MOVEMENT_QUANTITY E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-29 : 05:54:20
|
To slow. Needed to find link at www.w3schools.com/sql  E 12°55'05.63"N 56°04'39.26" |
 |
|
|
rluyinda
Starting Member
3 Posts |
Posted - 2009-05-29 : 05:56:22
|
| THX A MILLION, KH, IT WORKED!!AM NEW TO SQL, BUT I HAVE TO MAKE IT WORK ON A PROJECT.THX AGAIN GUY, KH. |
 |
|
|
rluyinda
Starting Member
3 Posts |
Posted - 2009-05-29 : 06:02:58
|
THX PESO FOR THE LINK!!quote: Originally posted by Peso
To slow. Needed to find link at www.w3schools.com/sql  E 12°55'05.63"N 56°04'39.26"
|
 |
|
|
|
|
|
|
|