Click here to Skip to main content
15,917,793 members
Home / Discussions / Database
   

Database

 
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 
AnswerRe: Compair Two tables and return result in column Pin
J4amieC19-May-10 2:25
J4amieC19-May-10 2:25 
You have 2 options here. Assume one of the two tables is the "master" and left join the other:


select t1.field1,t1.field2,
	t2.field1,t2.field2,
	CASE
		WHEN t2.field1 IS NOT NULL THEN 'Match' 
		ELSE 'Unmatch' 
	END
FROM Table1 t1
LEFT JOIN table2 t2		
ON t1.field1=t2.field1 AND t1.field2=t2.field2


or, cross join all of t1 against t2 to find matches.

select t1.field1,t1.field2,
	t2.field1,t2.field2,
	CASE
		WHEN t1.field1=t2.field1 AND t1.field2=t2.field2 THEN 'Match' 
                ELSE 'Unmatch' 
        END
FROM Table1 t1
CROSS JOIN table2 t2	


Im sure one of those 2 approaches will give you the result you're after.
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 
AnswerRe: Database Size Issues Pin
loyal ginger17-May-10 1:36
loyal ginger17-May-10 1:36 

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.