Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Actually i am having two tables (Tabel1,Tabel2)

Table11 Records:-

VB
ID   Name 
1    Sri
2    Giri


Tabel2 Records:-

VB
ID  Status
1    A
2    I



Now i want the record like for below statement

select * from tabel1,tabel2 where tabel1.ID=Tabel2.ID and Tabel2.Status='A' and name='Giri' Output should be like below.

VB
ID  Name  Status
2   Giri  Null
Posted
Updated 23-Feb-14 23:15pm
v3
Comments
What output you need?
ntitish 24-Feb-14 5:11am    
if i am doing like above no record is coming i need the record like the last table in my question after select statement.
Did you follow the solutions given below?
ntitish 24-Feb-14 5:38am    
yes but it is not working,...
Please add comments inside the question and ask them about this.

You can try the below code...


SQL
Select t1.ID,t1.NAME,t2.STATUS from Table1 t1
left join Table2 t2 on t1.ID=t2.ID and t2.STATUS='A'
where t1.ID=2
 
Share this answer
 
Comments
george4986 24-Feb-14 6:11am    
working code +5v
Follow the link it might help to you..


Visual Representation of SQL Joins[^]
 
Share this answer
 
v2
Comments
Maciej Los 24-Feb-14 3:40am    
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900