【发布时间】:2016-02-24 06:33:33
【问题描述】:
我有一个问题
select c.CommentId
,c.CommentText
, c.CommenterId
, c.CommentDate
, u.first_name
, u.last_name
, i.ImageName
, i.Format
from comment c
join users u
on c.CommenterId = u.user_id
join user_profile_image i
on u.user_id = i.UserId
where PostId = 76
order
by CommentDate desc
limit 10
当 i.ImageName 字段在表中为空时,此查询返回空结果。如果 ImageName 字段为空,我想返回该行。我该怎么做?
【问题讨论】:
-
出于好奇,您为什么要在一个表中调用字段
user_id而在另一个表中调用userid? -
@GordonLinoff 你是什么意思?我使用了一些现成的使用下划线的登录系统,但我个人不喜欢这样。如果这能满足你的好奇心?
-
FWIW,我更喜欢下划线。它可以防止 Pen Island 品种混淆。
-
笔岛品种??? :o
-
@whatever 。 . .我对下划线没有非常强烈的意见(就我个人而言,我会忽略它)。我确实对一致性有强烈的看法。