当前位置:编程学习 > thinkphp >>

亲测 thinkphp6和tinkphp5 查询 is not nul的sql写法

thinkphp 查询表达式错误:EXP 错误提示

网上的教程如下:

$where['yizuotu']=array('EQ','NULL');这样打印sql是WHERE ( `yizuotu` = 'NULL' );

如果需要为 WHERE ( `yizuotu`  IS NOT NULL );那需要使用exp;

$where['yizuotu']=array('EXP','IS NOT NULL');  测试错误

$where['yizuotu']=array('exp','!= ""'); 这种测试也错误



本人测试出错,后来使用了如下写法:

$where=[

'yizuotu' => array('<>', 'null'),


//'yizuotu' => array('neq', 'null'),


]

或者直接写在sql里面

->where('yizuotu is not null')


大家试试吧
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,