Get records using left outer join

Posted by Devendra Gohil on Stack Overflow See other posts from Stack Overflow or by Devendra Gohil
Published on 2012-06-11T10:35:44Z Indexed on 2012/06/11 10:40 UTC
Read the original article Hit count: 268

Filed under:
|

I have two tables as given below

    Table A                Table B             Table C              
  =============          ==============        =========
    Id    Name           Id   AId  CId         Id   Name 
    1     A              1    1    1           1    x
    2     B              2    1    1           2    y
    3     C              3    2    1           3    z 
    4     D              4    2    3           4    w
    5     E              5    3    2           5    v

Now I want all the records of Table A with matching Id column CId from Table B where CId = 1.

So the output should be like below :

Id Name CId
1   A   1 
2   B   1
3   C   1
4   D   Null
5   E   Null

Can anyone help me please?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2008