Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My results are correct with you data and queries.</p> <pre><code>CREATE TABLE `tiers` ( `id` int(11) DEFAULT NULL, `date_fin_val` datetime DEFAULT NULL, `est_tiers_physique` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into tiers (id, est_tiers_physique) values (1, 1); select * from tiers; +------+--------------+--------------------+ | id | date_fin_val | est_tiers_physique | +------+--------------+--------------------+ | 1 | NULL | 1 | +------+--------------+--------------------+ 1 row in set (0.00 sec) CREATE TABLE `tiers_critere_int` ( `id` int(11) DEFAULT NULL, `date_fin_val` datetime DEFAULT NULL, `id_tiers` int(11) DEFAULT NULL, `id_critere` int(11) DEFAULT NULL, `critere` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into tiers_critere_int (id, id_tiers, id_critere, critere) values (1, 1, 2, 86), (2, 1, 6, 170), (3, 1, 7, 65) ; select * from tiers_critere_int; +------+--------------+----------+------------+---------+ | id | date_fin_val | id_tiers | id_critere | critere | +------+--------------+----------+------------+---------+ | 1 | NULL | 1 | 2 | 86 | | 2 | NULL | 1 | 6 | 170 | | 3 | NULL | 1 | 7 | 65 | +------+--------------+----------+------------+---------+ 3 rows in set (0.00 sec) select t.id,t.date_fin_val,tc.date_fin_val from tiers t join tiers_critere_int tc on tc.id_tiers=t.id where (t.date_fin_val is null) and (tc.date_fin_val is null); +------+--------------+--------------+ | id | date_fin_val | date_fin_val | +------+--------------+--------------+ | 1 | NULL | NULL | | 1 | NULL | NULL | | 1 | NULL | NULL | +------+--------------+--------------+ 3 rows in set (0.00 sec) select t.id,t.date_fin_val,tc.date_fin_val from tiers t left outer join tiers_critere_int tc on tc.id_tiers=t.id where (t.date_fin_val is null) and (tc.date_fin_val is null); +------+--------------+--------------+ | id | date_fin_val | date_fin_val | +------+--------------+--------------+ | 1 | NULL | NULL | | 1 | NULL | NULL | | 1 | NULL | NULL | +------+--------------+--------------+ 3 rows in set (0.02 sec) </code></pre> <p>Now if you insert an empty string you will have:</p> <pre><code>insert into tiers (id, date_fin_val, est_tiers_physique) values (2, '', 1); Query OK, 1 row affected, 1 warning (0.00 sec) select * from tiers; +------+---------------------+--------------------+ | id | date_fin_val | est_tiers_physique | +------+---------------------+--------------------+ | 1 | NULL | 1 | | 2 | 0000-00-00 00:00:00 | 1 | +------+---------------------+--------------------+ 2 rows in set (0.00 sec) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload