Click here to Skip to main content
15,900,110 members
Home / Discussions / Database
   

Database

 
GeneralRe: Assist to solve this problem? Pin
Mycroft Holmes26-Jun-11 14:56
professionalMycroft Holmes26-Jun-11 14:56 
GeneralRe: Assist to solve this problem? Pin
David Skelly26-Jun-11 22:29
David Skelly26-Jun-11 22:29 
AnswerRe: Assist to solve this problem? Pin
Blue_Boy25-Jun-11 21:42
Blue_Boy25-Jun-11 21:42 
GeneralRe: Assist to solve this problem? [modified] Pin
current199917-Jul-11 21:48
current199917-Jul-11 21:48 
AnswerRe: Assist to solve this problem? Pin
Niladri_Biswas4-Jul-11 0:44
Niladri_Biswas4-Jul-11 0:44 
GeneralRe: Assist to solve this problem? Pin
current199918-Jul-11 0:00
current199918-Jul-11 0:00 
QuestionStored procedure from SSIS Pin
Groulien24-Jun-11 0:11
Groulien24-Jun-11 0:11 
AnswerRe: Stored procedure from SSIS Pin
R. Giskard Reventlov24-Jun-11 1:57
R. Giskard Reventlov24-Jun-11 1:57 
AnswerRe: Stored procedure from SSIS [modified] Pin
UNCRushFan24-Jun-11 2:03
UNCRushFan24-Jun-11 2:03 
GeneralRe: Stored procedure from SSIS Pin
Groulien27-Jun-11 3:28
Groulien27-Jun-11 3:28 
GeneralRe: Stored procedure from SSIS Pin
UNCRushFan27-Jun-11 5:06
UNCRushFan27-Jun-11 5:06 
QuestionShow Statement Pin
programmervb.netc++23-Jun-11 6:30
programmervb.netc++23-Jun-11 6:30 
AnswerRe: Show Statement Pin
Blue_Boy23-Jun-11 6:50
Blue_Boy23-Jun-11 6:50 
GeneralRe: Show Statement Pin
programmervb.netc++23-Jun-11 7:11
programmervb.netc++23-Jun-11 7:11 
AnswerRe: Show Statement Pin
Pete O'Hanlon23-Jun-11 7:26
mvePete O'Hanlon23-Jun-11 7:26 
GeneralRe: Show Statement Pin
programmervb.netc++23-Jun-11 7:31
programmervb.netc++23-Jun-11 7:31 
GeneralRe: Show Statement Pin
jschell23-Jun-11 8:35
jschell23-Jun-11 8:35 
QuestionRe: Show Statement Pin
Eddy Vluggen23-Jun-11 9:14
professionalEddy Vluggen23-Jun-11 9:14 
QuestionSQL Jobs Output Pin
Groulien23-Jun-11 4:05
Groulien23-Jun-11 4:05 
AnswerRe: SQL Jobs Output [modified] Pin
UNCRushFan23-Jun-11 7:30
UNCRushFan23-Jun-11 7:30 
GeneralRe: SQL Jobs Output Pin
Groulien23-Jun-11 22:56
Groulien23-Jun-11 22:56 
Questionis these two queries same? Pin
Dhyanga23-Jun-11 3:08
Dhyanga23-Jun-11 3:08 
Hi all,

Is there any difference between the following two sets of queries?

select a.ID_NUM as ID, b.LAST_NAME, b.FIRST_NAME, c.BIRTH_DTE, RIGHT(c.SSN, 4),
                        a.RESIDSTS, d.ROOM_DESC, d.ROOM_PHONE
                        from SMASTER a 
                        join NMASTER b on a.ID_NUM = b.ID_NUM
                        join BMASTER c on a.ID_NUM = c.ID_NUM
                        join RMASTER d on a.LOC_CDE = d.LOC_CDE and a.BLDG_CDE = d.BLDG_CDE and a.ROOM_CDE = d.ROOM_CDE
                        where LOWER(b.LAST_NAME) like '%ram%'
                        and a.RESIDSTS = 'R' and (a.T_CDE in ('20', '21') or a.UDEF in ('20', '21'))
 UNION 
select a.ID_NUM as ID, b.LAST_NAME, b.FIRST_NAME, c.BIRTH_DTE, RIGHT(c.SSN, 4),
                        a.RESIDSTS as STATUS, '' , '' 
                        from SMASTER a 
                        join NMASTER b on a.ID_NUM = b.ID_NUM
                        join BMASTER c on a.ID_NUM = c.ID_NUM
						join RMASTER d on a.ID_NUM = a.ID_NUM
                        where LOWER(b.LAST_NAME) like '%ram%'
                        and a.RESIDSTS <> 'R' and (a.T_CDE in ('20', '21') or a.UDEF in ('20', '21'))


and
select a.ID_NUM as ID, b.LAST_NAME, b.FIRST_NAME, c.BIRTH_DTE, RIGHT(c.SSN, 4),
                        a.RESIDSTS, d.ROOM_DESC, d.ROOM_PHONE
                        from SMASTER a 
                        join NMASTER b on a.ID_NUM = b.ID_NUM
                        join BMASTER c on a.ID_NUM = c.ID_NUM
                        join RMASTER d on a.LOC_CDE = d.LOC_CDE and a.BLDG_CDE = d.BLDG_CDE and a.ROOM_CDE = d.ROOM_CDE
                        where LOWER(b.LAST_NAME) like '%ram%'
                        and (a.RESIDSTS = 'R' or a.RESIDSTS <> 'R') and (a.T_CDE in ('20', '21') or a.UDEF in ('20', '21'))


well in one there is "UNION" used but will there any difference in the output or are these both queries same as per the output is concered?
suchita

AnswerRe: is these two queries same? Pin
JV999923-Jun-11 3:44
professionalJV999923-Jun-11 3:44 
GeneralRe: is these two queries same? Pin
Dhyanga23-Jun-11 3:53
Dhyanga23-Jun-11 3:53 
Questionproblem trying to use UNION in the sql query Pin
Dhyanga23-Jun-11 3:03
Dhyanga23-Jun-11 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.