i have table like this .............................
sno name mobile area
1 swapna 9849313821 hyd
2 abilash 987543211 hyd
3 swapna priya 98765313892 vizag
4 shashikiran 9765423111 hyd
5 shashi 9876543211 hyd
6 raju 9876557899 jyd
i want to select only same names ......
sno name mobile area
1 swapna 9849313821 hyd
3 swapna priya 98765313892 vizag
4 shashikiran 9765423111 hyd
5 shashi 9876543211 hyd
Loading
Priyank KharePosted Nov 7, 2013, 1:19 PM
select * from tablename where name like 's%'
Sanjeeb LenkaPosted Oct 30, 2013, 7:27 AM
here i used self join in table1.
SELECT t1.name,t1.mobile,t1.area, count(*)
FROM table1 t1
JOIN table1 t2
ON t1.name LIKE '%' + t2.name + '%' or t2.name LIKE '%' + t1.name + '%'
group by t1.name,t1.mobile,t1.area
HAVING count(*) > 1
JAYRAMPosted Oct 30, 2013, 5:05 AM
Sanjeeb LenkaPosted Oct 30, 2013, 4:42 AM