Click here to Skip to main content
15,886,640 members
Home / Discussions / Database
   

Database

 
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 
AnswerRe: problem trying to use UNION in the sql query Pin
Dhyanga23-Jun-11 4:04
Dhyanga23-Jun-11 4:04 
AnswerRe: problem trying to use UNION in the sql query Pin
Chris Meech23-Jun-11 4:16
Chris Meech23-Jun-11 4:16 
QuestionMySqlDBType equivalent of SqlDBType.Char in routines (stored procedures) Pin
TheComputerMan22-Jun-11 0:57
TheComputerMan22-Jun-11 0:57 
AnswerRe: MySqlDBType equivalent of SqlDBType.Char in routines (stored procedures) Pin
Mycroft Holmes23-Jun-11 11:59
professionalMycroft Holmes23-Jun-11 11:59 
GeneralRe: MySqlDBType equivalent of SqlDBType.Char in routines (stored procedures) Pin
TheComputerMan23-Jun-11 22:15
TheComputerMan23-Jun-11 22:15 
GeneralRe: MySqlDBType equivalent of SqlDBType.Char in routines (stored procedures) Pin
Mycroft Holmes23-Jun-11 22:24
professionalMycroft Holmes23-Jun-11 22:24 
GeneralRe: MySqlDBType equivalent of SqlDBType.Char in routines (stored procedures) Pin
TheComputerMan23-Jun-11 22:57
TheComputerMan23-Jun-11 22:57 
QuestionLookup Columns In Access via Linked Data? Pin
Matt U.21-Jun-11 11:41
Matt U.21-Jun-11 11:41 
AnswerRe: Lookup Columns In Access via Linked Data? Pin
_Damian S_21-Jun-11 14:34
professional_Damian S_21-Jun-11 14:34 
GeneralRe: Lookup Columns In Access via Linked Data? Pin
Matt U.21-Jun-11 14:48
Matt U.21-Jun-11 14:48 
GeneralRe: Lookup Columns In Access via Linked Data? Pin
_Damian S_21-Jun-11 14:52
professional_Damian S_21-Jun-11 14:52 
GeneralRe: Lookup Columns In Access via Linked Data? Pin
Matt U.21-Jun-11 15:04
Matt U.21-Jun-11 15:04 
GeneralRe: Lookup Columns In Access via Linked Data? Pin
Mycroft Holmes21-Jun-11 18:36
professionalMycroft Holmes21-Jun-11 18:36 
AnswerRe: Lookup Columns In Access via Linked Data? Pin
Mycroft Holmes21-Jun-11 18:41
professionalMycroft Holmes21-Jun-11 18:41 

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.