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.3k
Require Select query ?
Feb 3 2020 2:06 AM
i want select join query below is data ,
my requirement is that ,i want to display balesize from itemmasterfile and Probale table,
if balesize exit in Probale table then take balesize from Probale table ,if bale size in Probale table is null then it will take from itemmaster file ,
CREATE
TABLE
#ItemMasterFile(CodeItem
INT
,Descriptionitem
VARCHAR
(50),Balesize
varchar
(50))
CREATE
TABLE
#Probale(BID
INT
,CodeItem
INT
,prdQTY
INT
,Entrydate DATETIME,Balesize
varchar
(50))
INSERT
INTO
#ItemMasterFile
VALUES
(1,
'A'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(2,
'B'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(3,
'C'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(4,
'D'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(5,
'e'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(6,
'f'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(7,
'g'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(8,
'h'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(9,
'K'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(10,
'L'
,
'100lbs'
)
INSERT
INTO
#ItemMasterFile
VALUES
(11,
'M'
,
'100lbs'
)
INSERT
INTO
#Probale
VALUES
(10011,1,1,
'01-06-2019'
,
null
)
INSERT
INTO
#Probale
VALUES
(10012,3,1,
'02-06-2019'
,
null
)
INSERT
INTO
#Probale
VALUES
(10013,11,1,
'03-06-2019'
,
null
)
INSERT
INTO
#Probale
VALUES
(10014,10,1,
'08-06-2019'
,
null
)
INSERT
INTO
#Probale
VALUES
(10015,8,1,
'03-06-2019'
,
'150 lbs'
)
INSERT
INTO
#Probale
VALUES
(10016,9,1,
'08-06-2019'
,
'150 lbs'
)
INSERT
INTO
#Probale
VALUES
(10017,9,1,
'08-06-2019'
,
'150 lbs'
)
Reply
Answers (
2
)
Change Datatype Varchar to Date.
select query with two foreign Key require