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 |
pradeepbliss
Starting Member
28 Posts |
Posted - 2015-03-20 : 05:41:35
|
I have Two tables @master and @childMaster Table : MasterID EntryNumber BranchId IsstockIn 1 1 1 1 2 1 1 0Child Table:CEntryNumber CBranchID EntryQty 1 1 10 1 1 20 1 1 -5 1 1 -4My Query:Select SEC.EntryQty from Item.StockEntryChild SECwhere SEC.CEntryNo = ( select SEM.EntryNumber from item.StockEntryMaster SEM where SEC.CBranchID=SEM.BranchID and SEC.CEntryNo=SEM.EntryNumber and SEM.MasterID=1 and SEM.isStockIn=1)My Result:EntryQty 10 20 -5 -4Expected Result: 10 20 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2015-03-20 : 06:17:28
|
Try thisSelect SEC.EntryQty from Item.StockEntryChild SEC inner join item.StockEntryMaster SEM on SEC.CEntryNo = SEM.EntryNumber andSEC.CBranchID=SEM.BranchID and SEC.CEntryNo=SEM.EntryNumber where SEM.MasterID=1 and SEM.isStockIn=1MadhivananFailing to plan is Planning to fail |
|
|
pradeepbliss
Starting Member
28 Posts |
Posted - 2015-03-20 : 06:23:41
|
No i am getting same as actual result failed to obtain the expected resultquote: Originally posted by madhivanan Try thisSelect SEC.EntryQty from Item.StockEntryChild SEC inner join item.StockEntryMaster SEM on SEC.CEntryNo = SEM.EntryNumber andSEC.CBranchID=SEM.BranchID and SEC.CEntryNo=SEM.EntryNumber where SEM.MasterID=1 and SEM.isStockIn=1MadhivananFailing to plan is Planning to fail
|
|
|
|
|
|