可以用 select count(*) from table where username ='dpstill';
查询的结果=0 就不存在 >0 就存在
如果要用其他结果返回的话,可以用下面的
select case when COUNT(*)>0 then '存在' when count(*)=0 then '不存在' end from table where username ='dpstill'
查询mysql中如何判断某一个字段是否存在某一个值
最新推荐文章于 2025-04-27 21:20:24 发布