[英]How to join two tables when one column is null?
我有兩個表t1
和t2
。
t1
有三個列a
, b
, c
和t2
有兩個列x
, y
。
我想在t2.x=t1.c
上加入這兩個表。 盡管對t1.c
為null
時t1.c
真正的問題,但它對我t1.c
。 我該如何解決這個問題。 我正在使用Codeigniter Active Record類和mysql。
在Code Igniter中-您需要指定join函數的第3個參數。 例:
$this->db->join('t2', 't1.x = t2.c', 'left');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.