我一直在尝试使用该IsNull()函数来确保字段的值.
SELECT crawled.id,
IsNull(sranking.score,0) as Score,
crawled.url,
crawled.title,
crawled.blurb
FROM crawled
LEFT JOIN sranking ON crawled.id = sranking.sid
WHERE crawled.body LIKE '%".$term."%'
ORDER BY Score DESC LIMIT " . $start . "," . $c
Run Code Online (Sandbox Code Playgroud)
但我收到错误消息:
调用本机函数'IsNull'时参数计数不正确
有人有什么想法吗?我是MySQL的新手.
new*_*ver 10
ISNULL测试传递的表达式是否为NULL.如上所述,你需要的是IFNULL或COALESCE xyld.
SELECT crawled.id, IFNULL(sranking.score, 0) as Score, ...
Run Code Online (Sandbox Code Playgroud)