【发布时间】:2011-08-01 15:22:42
【问题描述】:
非常快速的问题!
如果表 FK 有一个空值,我有什么方法可以设计我的查询,这样它就不会麻烦加入与外键关联的表。我目前正在使用左连接。
我可以使用另一个连接吗?或者我可以在我的查询中使用 PHP 执行类似的操作吗?
if (table foreign key == NULL)
{
do not join table that foreign key points to
}
else
{
join table using foreign key value
}
谢谢
【问题讨论】:
标签: php mysql codeigniter activerecord