38
38
# Test for LEAST() BUG in LEFT JOIN
40
CREATE TABLE t1 ( faq_group_id int NOT NULL default '0', faq_id int NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status int NOT NULL default '0', access_id int default NULL, lang_id int NOT NULL default '0', created datetime NULL, updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int NOT NULL default '0', static_solved int default NULL, solved_1 int default NULL, solved_2 int default NULL, solved_3 int default NULL, solved_4 int default NULL, solved_5 int default NULL, expires datetime default NULL, notes text, assigned_to int default NULL, assigned_group int default NULL, last_edited_by int default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate int default NULL, c$contributor int default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) );
40
CREATE TABLE t1 ( faq_group_id int NOT NULL default '0', faq_id int NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status int NOT NULL default '0', access_id int default NULL, lang_id int NOT NULL default '0', created datetime NULL, updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int NOT NULL default '0', static_solved int default NULL, solved_1 int default NULL, solved_2 int default NULL, solved_3 int default NULL, solved_4 int default NULL, solved_5 int default NULL, expires datetime default NULL, notes text, assigned_to int default NULL, assigned_group int default NULL, last_edited_by int default NULL, orig_ref_no varchar(15) default NULL, c$fundstate int default NULL, c$contributor int default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) );
41
41
INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\">�</td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\">�</td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
42
CREATE TABLE t2 ( access_id int NOT NULL default '0', name varchar(20) binary default NULL, rank int NOT NULL default '0', KEY t2$access_id (access_id) );
42
CREATE TABLE t2 ( access_id int NOT NULL default '0', name varchar(20) default NULL, rank int NOT NULL default '0', KEY t2$access_id (access_id) );
43
43
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
44
44
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;