create table mysampletable (id int,name1 varchar(100))
insert into mysampletable values(1,'Venkat')
insert into mysampletable values(2,'Venkat1')
insert into mysampletable values(3,'Venkat2')
insert into mysampletable values(4,'Venkat3')
create table mysampletable1 (id int,name1 varchar(100))
insert into mysampletable1 values(1,'Venkat')
insert into mysampletable1 values(2,'Venkat1')
insert into mysampletable1 values(3,'Venkat2')
insert into mysampletable1 values(4,'Venkat3')
select * from mysampletable
select * from mysampletable1
select *,(select count(*) from mysampletable1 where mysampletable1.id=mysampletable.id) as 'Rowexistsin Secondtable'
from mysampletable where mysampletable.id =1
No comments:
Post a Comment