Click here to Skip to main content
15,910,787 members
Home / Discussions / Database
   

Database

 
QuestionSQL query problem Pin
josephong19-May-10 19:31
josephong19-May-10 19:31 
AnswerRe: SQL query problem Pin
_Damian S_19-May-10 20:19
professional_Damian S_19-May-10 20:19 
GeneralRe: SQL query problem Pin
josephong19-May-10 21:49
josephong19-May-10 21:49 
GeneralRe: SQL query problem Pin
Shameel23-May-10 5:21
professionalShameel23-May-10 5:21 
QuestionCompair Two tables and return result in column Pin
Sachin Pimpale18-May-10 23:41
Sachin Pimpale18-May-10 23:41 
AnswerRe: Compair Two tables and return result in column Pin
Tripathi Swati19-May-10 0:19
Tripathi Swati19-May-10 0:19 
GeneralRe: Compair Two tables and return result in column Pin
Sachin Pimpale19-May-10 1:53
Sachin Pimpale19-May-10 1:53 
GeneralRe: Compair Two tables and return result in column Pin
Tripathi Swati19-May-10 20:17
Tripathi Swati19-May-10 20:17 
HI pls try below code


Select
C1,
C2,
C3,
C4,
case when  (C1 + C2) = (C3 + C4) then 'Match'
 else 'Unmatch' end as Result
From 
(

	Select 
	Row,
	Max(C1) as C1,
	Max(C2) as C2,
	Max(C3) as C3 ,
	Max(C4) as C4
	From 
	(
				Select 
				ROW_NUMBER() 
						OVER (ORDER BY TABLE_A.Field_1) AS Row,
				TABLE_A.Field_1  as C1
				,TABLE_A.Field_2  as C2
				,'0' as C3
				,'0' as C4
				From 
				TABLE_A

				Union ALL

				Select 
				ROW_NUMBER() 
						OVER (ORDER BY TABLE_B.Field_1) AS Row,
				'0'  as C1
				,'0' as C2
				,TABLE_B.Field_1  as C3
				,TABLE_B.Field_2  as C4
				From 
				TABLE_B
	  )
	  as OuterTable
	  group by Row
	  
) as FinalTable


n yes let me know which sql version u r using because in sql 2008 we have
merge statement too...

i hope this will help you ..
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi

AnswerRe: Compair Two tables and return result in column Pin
J4amieC19-May-10 2:25
J4amieC19-May-10 2:25 
QuestionDatawarehousing in oracle Pin
richa02118-May-10 11:42
richa02118-May-10 11:42 
AnswerRe: Datawarehousing in oracle Pin
i.j.russell18-May-10 12:26
i.j.russell18-May-10 12:26 
AnswerRe: Datawarehousing in oracle Pin
Dr.Walt Fair, PE18-May-10 12:45
professionalDr.Walt Fair, PE18-May-10 12:45 
Questioncall an SQL function in VBscript Pin
richa02118-May-10 11:40
richa02118-May-10 11:40 
AnswerRe: call an SQL function in VBscript Pin
Dimitri Witkowski20-May-10 10:12
Dimitri Witkowski20-May-10 10:12 
Questionsql server insert Pin
msomar17-May-10 16:01
msomar17-May-10 16:01 
AnswerRe: sql server insert Pin
Luc Pattyn17-May-10 16:30
sitebuilderLuc Pattyn17-May-10 16:30 
GeneralRe: sql server insert Pin
msomar17-May-10 16:58
msomar17-May-10 16:58 
GeneralRe: sql server insert Pin
Luc Pattyn17-May-10 17:40
sitebuilderLuc Pattyn17-May-10 17:40 
GeneralRe: sql server insert Pin
Bernhard Hiller17-May-10 19:43
Bernhard Hiller17-May-10 19:43 
GeneralRe: sql server insert Pin
msomar17-May-10 21:36
msomar17-May-10 21:36 
GeneralRe: sql server insert Pin
T M Gray18-May-10 7:56
T M Gray18-May-10 7:56 
GeneralRe: sql server insert Pin
Luc Pattyn18-May-10 8:45
sitebuilderLuc Pattyn18-May-10 8:45 
GeneralRe: sql server insert Pin
Shameel23-May-10 5:25
professionalShameel23-May-10 5:25 
AnswerRe: sql server insert Pin
Md. Marufuzzaman17-May-10 19:57
professionalMd. Marufuzzaman17-May-10 19:57 
QuestionDatabase Size Issues Pin
Ed Hill _5_16-May-10 22:46
Ed Hill _5_16-May-10 22:46 

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.