1582:Incorrect parameter count in the call to native function ‘ISNULL’ [ SQL语句 ] : select id,house_title as title from housesell where 1 and city_id=2 order by ISNULL(is_top, 0, 1),is_top desc limit 0,30

使用的数据库系统可能不支持在 ISNULL 函数中传递多个参数。通常,ISNULL 函数只接受两个参数,即要检查的表达式和在表达式为 NULL 时要返回的默认值。

如果你想要在排序时将 NULL 值排在最后,你可以使用 COALESCE 函数,因为它可以接受多个参数。以下是你的查询使用 COALESCE 的修改:

SELECT id, house_title AS title
FROM housesell
WHERE city_id = 2
ORDER BY COALESCE(is_top, 0), is_top DESC
LIMIT 0, 30;

作者 admin

百度广告效果展示