id | name | symbol
1 | test | T1
2 | test2 | T2
3 | tesa | Ta
4 | inne | T1pokaz
5 | inne2 | T2pokaz
Kod
select * from tabela where name like ('%test%') and symbol like (select symbol from tabela where name like ('%test%') + '%')
docelowo powinno pokazać:
id | name | symbol
1 | test | T1
4 | inne | T1pokaz
2 | test2 | T2
5 | inne2 | T2pokaz
Jak napisać takie zapytanie ?