Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Monday March 09, 2009
11:34 AM

I should give up on SQL

[ #38621 ]

Stared and stared and stared at the "is null"/"is not null" constraints and had to post to twitter to find the answer. Very annoying that I missed something so obvious, but I still don't know why it would munge the value of "parent_pid" and "child_pid" in the first query. (Update: Of course I know why it would munge that value. I need a drink).

mysql> select parent_pid, child_pid, title from clip left join pip_pip on clip.pid = child_pid and parent_pid is null;
+------------+-----------+-------------------------------+
| parent_pid | child_pid | title                         |
+------------+-----------+-------------------------------+
| NULL       | NULL      | Another clip                  |
| NULL       | NULL      | Clip 2 with attached variants |
| NULL       | NULL      | Clip with attached variants   |
+------------+-----------+-------------------------------+
3 rows in set (0.00 sec)

mysql> select parent_pid, child_pid, title from clip left join pip_pip on clip.pid = child_pid and parent_pid is not null;
+------------+-----------+-------------------------------+
| parent_pid | child_pid | title                         |
+------------+-----------+-------------------------------+
| NULL       | NULL      | Another clip                  |
| NULL       | NULL      | Clip 2 with attached variants |
| b00btc34   | b0001234  | Clip with attached variants   |
+------------+-----------+-------------------------------+
3 rows in set (0.00 sec)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.