journal
all ![]() | Rob is 20,117 days old today. |
Nov 2007 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Jan 2008 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2006 jan feb mar apr may jun jul aug sep oct nov dec
2008 jan feb mar apr may jun jul aug sep oct nov dec |< << more >> >| |
Entries this day: phpMyAdmin phpMyAdmin 9:24pm JST Tuesday 11 December 2007 (day 13775) Note to self: Self, if you need to write a hairy mySQL query, and you have a choice between
use phpMyAdmin. What I couldn't do all day (I'm talkin' 8 hours) via the first method, I did in 1 hour the second way. Here is the resulting mySQL: SELECT um.uid, mi.mission_type, up.mission_id, up.publish_id, ur.status FROM User_Remun AS ur RIGHT JOIN User_Publish AS up USING ( publish_id ) LEFT JOIN Mission_Info AS mi USING ( mission_id ) LEFT JOIN User_Master AS um USING ( uid ) WHERE uid =4 AND mi.start_term <= now( ) AND mi.end_term >= now( ) AND ((mi.mission_type = 'normal' AND ur.status IS NULL) OR (mi.mission_type = 'monitor' AND ur.status = 9)) {AND mi.mission_id = 46} The last line is optional, depending on whether the user said "tell me what I can do" or asked "can I do this?" All in one beautiful query, that merges four (4) tables and runs in about 0.0006 seconds... permalinkprev day next day |