带有sql%通配符和where子句的子查询 [英] Subquery with sql % wildcards and where clause

查看:119
本文介绍了带有sql%通配符和where子句的子查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在子句中使用%通配符..



我无法得到准确的结果..



i用于此查询



select * from tbl_tree其中sponcer_id喜欢'%'(从tbl_tree中选择distinct(sponcer_id),其中advisor_id = 29)



sponcer_id可能像'29,20,25,0'



i想得到最后一个值的值像sponcerid这样的列不完全是这个值只有最后四个值应该是这样的..



帮助.. !!!

how to use %wildcards in where Clause..

I couldnt get exact Result..

i was used this Query

select * from tbl_tree where sponcer_id like '%'(select distinct(sponcer_id) from tbl_tree where advisor_id=29)

the sponcer_id may be like '29,20,25,0'

i wanna get the value where the last value in a column like the sponcerid not exactly this value only the last four value should be like this..

Help..!!!

推荐答案

我想你想要IN而不是LIKE。

如果没有,JOIN可能会做你想要的。





PS我更喜欢避免子查询。
I'm thinking you want IN rather than LIKE.
If not, a JOIN will likely do what you want.


P.S. I prefer to avoid subqueries.


这篇关于带有sql%通配符和where子句的子查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆