TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Peter Dzuya
NA
313
41k
Stored Procedure
May 8 2015 12:14 PM
Hi everyone.
I have a stored procedure which queries data from three tables named StockBfwd, ReceiptMonthly, IssueMonthly. it works very well only that when one table does not have the information that relates to the two, then no results are thrown. the stored procedure is shown here below.
SELECT DISTINCT Stock.StockId, Stock.PartNo, Stock.ItemName, Stock.Packaging1, Stock.Packaging2, Stock.Bin, StockBfwd.StockBfwd AS Bfwd,
Stock.UnitCost, Stock.UnitSell, Stock.SubCategoryId, SubCategory.SubCategoryName,
(SELECT SUM(ReceiptMonthly.StockIn) FROM ReceiptMonthly WHERE ReceiptMonthly.StockId=Stock.StockId) AS StockIn,
(SELECT SUM(IssueMonthly.StockOut) FROM IssueMonthly WHERE IssueMonthly.StockId=Stock.StockId) AS StockOut
FROM Stock LEFT OUTER JOIN
StockBfwd ON Stock.StockId = StockBfwd.StockID INNER JOIN
ReceiptMonthly ON Stock.StockId = ReceiptMonthly.StockId INNER JOIN
IssueMonthly ON Stock.StockId = IssueMonthly.StockId INNER JOIN
SubCategory ON Stock.SubCategoryId = SubCategory.SubCategoryId;
Thanks
Reply
Answers (
1
)
Pass data in Json format to restAPI using httpwebrequest C#
FORM APP (C#) > DELETE PROBLEM SQL-!DATABASE