Click here to Skip to main content
15,915,093 members
Home / Discussions / Database
   

Database

 
GeneralRe: need help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
Michael J. Eber15-Mar-10 7:47
Michael J. Eber15-Mar-10 7:47 
GeneralRe: need help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
i.j.russell15-Mar-10 9:31
i.j.russell15-Mar-10 9:31 
QuestionGetting SP results from a table with multiple rows for same ID [modified] Pin
DeepToot12-Mar-10 9:37
DeepToot12-Mar-10 9:37 
AnswerRe: Getting SP results from a table with multiple rows for same ID Pin
Luc Pattyn12-Mar-10 10:06
sitebuilderLuc Pattyn12-Mar-10 10:06 
GeneralRe: Getting SP results from a table with multiple rows for same ID Pin
DeepToot12-Mar-10 10:15
DeepToot12-Mar-10 10:15 
AnswerRe: Getting SP results from a table with multiple rows for same ID Pin
riced12-Mar-10 13:49
riced12-Mar-10 13:49 
GeneralRe: Getting SP results from a table with multiple rows for same ID Pin
DeepToot15-Mar-10 5:06
DeepToot15-Mar-10 5:06 
Questionhelp me understanding left join Pin
Mogamboo_Khush_Hua11-Mar-10 19:28
Mogamboo_Khush_Hua11-Mar-10 19:28 
I want to select all values from @table1 that doesn't exist in @table2 , for that see the below scenario and the query, although i get the correct result but i doesn't understand how query is evaluated , I know the concept of left join but how where is evaluated , i can't understand ?

Is query is evaluating like this

1 from @table1 & 1 from @table2

then , 1=1 and t2.id is null = 1=1 and false= no rows.

now , suppose

2 from @table1 and 1 from @table2

then , 2=1 and t2.id is null = 2=1 and false = no rows , according to me but here it is giving 2,

IS Where condition applies only to those rows that are equal in both table.







Please help me ?

DECLARE @Table1 TABLE
(
ID INT
)

INSERT @Table1
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 6 UNION ALL
SELECT 7

DECLARE @Table2 TABLE
(
ID INT
)

INSERT @Table2
SELECT 1 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 5 UNION ALL
SELECT 7 UNION ALL
SELECT NULL



SELECT t1.ID
FROM @Table1 AS t1
LEFT JOIN @Table2 AS t2
ON t1.ID = t2.ID
WHERE t2.ID is null
AnswerRe: help me understanding left join Pin
Rod Kemp11-Mar-10 22:39
Rod Kemp11-Mar-10 22:39 
AnswerRe: help me understanding left join Pin
Mycroft Holmes11-Mar-10 23:15
professionalMycroft Holmes11-Mar-10 23:15 
GeneralRe: help me understanding left join Pin
Mogamboo_Khush_Hua12-Mar-10 2:16
Mogamboo_Khush_Hua12-Mar-10 2:16 
QuestionAccess 2007 - tabbed forms manage own popups Pin
john john mackey11-Mar-10 5:33
john john mackey11-Mar-10 5:33 
AnswerRe: Access 2007 - tabbed forms manage own popups Pin
Eddy Vluggen12-Mar-10 2:23
professionalEddy Vluggen12-Mar-10 2:23 
GeneralRe: Access 2007 - tabbed forms manage own popups Pin
john john mackey16-Mar-10 7:37
john john mackey16-Mar-10 7:37 
Questionproject Pin
salemmohamed10-Mar-10 22:54
salemmohamed10-Mar-10 22:54 
AnswerRe: project Pin
Mycroft Holmes10-Mar-10 23:53
professionalMycroft Holmes10-Mar-10 23:53 
AnswerRe: project Pin
R. Giskard Reventlov11-Mar-10 0:01
R. Giskard Reventlov11-Mar-10 0:01 
GeneralRe: project Pin
Mycroft Holmes11-Mar-10 19:07
professionalMycroft Holmes11-Mar-10 19:07 
GeneralRe: project Pin
Rob Graham14-Mar-10 6:32
Rob Graham14-Mar-10 6:32 
GeneralRe: project Pin
Mycroft Holmes14-Mar-10 14:50
professionalMycroft Holmes14-Mar-10 14:50 
QuestionWhat is special about 'Asynchronous Processing=true' in the connection string? Pin
Rob Philpott10-Mar-10 6:18
Rob Philpott10-Mar-10 6:18 
AnswerRe: What is special about 'Asynchronous Processing=true' in the connection string? Pin
Mycroft Holmes10-Mar-10 23:56
professionalMycroft Holmes10-Mar-10 23:56 
AnswerRe: What is special about 'Asynchronous Processing=true' in the connection string? Pin
Eddy Vluggen11-Mar-10 1:56
professionalEddy Vluggen11-Mar-10 1:56 
QuestionStreaming SQL table data to secondary location Pin
bonkers12310-Mar-10 3:54
bonkers12310-Mar-10 3:54 
AnswerRe: Streaming SQL table data to secondary location Pin
Tim Carmichael10-Mar-10 4:07
Tim Carmichael10-Mar-10 4:07 

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.