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
Akhter HUssain
712
1.3k
103.2k
Stock Report Required
Dec 27 2019 7:16 AM
i have below data ...
I am Making product in Probale table ,then i am creating Packs in (PackM,PackD"MasterDetail" ) table ,then i am dispatching Packs in (DispatachM ,DispatachD"MasterDetail") table
CREATE
TABLE
#ItemMasterFile(CodeItem
INT
,Descriptionitem
VARCHAR
(50))
CREATE
TABLE
#Probale(BID
INT
,CodeItem
INT
,prdQTY
INT
,Entrydate DATETIME)
CREATE
TABLE
#PackM(PID
INT
, Entrydate DATETIME)
CREATE
TABLE
#PackD(DID
INT
,PID
int
,BID
int
,Codeitem
int
,prdQTY
int
)
CREATE
TABLE
#DispatchM(DID
INT
, Entrydate DATETIME)
Create
Table
#DispatachD(ID
int
,DID
int
,PID
int
)
INSERT
INTO
#ItemMasterFile
VALUES
(1,
'A'
)
INSERT
INTO
#ItemMasterFile
VALUES
(2,
'B'
)
INSERT
INTO
#ItemMasterFile
VALUES
(3,
'C'
)
INSERT
INTO
#ItemMasterFile
VALUES
(4,
'D'
)
INSERT
INTO
#ItemMasterFile
VALUES
(5,
'e'
)
INSERT
INTO
#ItemMasterFile
VALUES
(6,
'f'
)
INSERT
INTO
#ItemMasterFile
VALUES
(7,
'g'
)
INSERT
INTO
#ItemMasterFile
VALUES
(8,
'h'
)
INSERT
INTO
#ItemMasterFile
VALUES
(9,
'K'
)
INSERT
INTO
#ItemMasterFile
VALUES
(10,
'L'
)
INSERT
INTO
#ItemMasterFile
VALUES
(11,
'M'
)
INSERT
INTO
#Probale
VALUES
(10011,1,1,
'01-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10012,3,1,
'02-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10013,11,1,
'03-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10014,10,1,
'08-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10015,8,1,
'03-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10016,9,1,
'08-06-2019'
)
INSERT
INTO
#Probale
VALUES
(10017,9,1,
'08-06-2019'
)
INSERT
INTO
#PackM
VALUES
(1001,
'01-06-2019'
)
INSERT
INTO
#PackM
VALUES
(1002,
'01-06-2019'
)
INSERT
INTO
#PackD
VALUES
(1,1001,10011,1,1)
INSERT
INTO
#PackD
VALUES
(2,1001,10012,3,1)
INSERT
INTO
#PackD
VALUES
(3,1001,10013,11,1)
INSERT
INTO
#PackD
VALUES
(4,1001,10014,10,1)
INSERT
INTO
#PackD
VALUES
(5,1002,10015,8,1)
INSERT
INTO
#PackD
VALUES
(6,1002,10016,9,1)
INSERT
INTO
#PackD
VALUES
(7,1002,10017,9,1)
INSERT
INTO
#DispatchM
VALUES
(101,
'01-06-2019'
)
INSERT
INTO
#DispatchM
VALUES
(102,
'01-06-2019'
)
INSERT
INTO
#DispatachD
VALUES
(1,101,1001)
INSERT
INTO
#DispatachD
VALUES
(1,102,1002)
Require Ouput is
Total Probale(Sum of Probale QTY)
Dispatch(Sum of PackD QTY) ,if PackM table PID is exit in DispatachD
Pending (Total Probale Minus From Dispatch)
Item
Total probale
Dispatch
Pending
A
1
1
0
B
0
0
0
C
1
1
0
D
0
0
0
E
0
0
0
F
0
0
0
G
0
0
0
H
1
1
0
K
2
2
0
L
1
1
0
M
1
1
0
Reply
Answers (
13
)
if table does not exist in database in mysql how to skip tab
In sql below query how it is working on with detail?