Difference between revisions of "A, An, The"

From LinuxMCE
Jump to: navigation, search
(Created page with "== SQL Query == sql Query, needs work. string sSQL_Sort = "SELECT PK_Attribute,CASE WHEN SUBSTRING_INDEX(Name, ' ', 1) IN ('a','an','the') THEN CONCAT(SUBSTRING(Name, I...")
(No difference)

Revision as of 03:49, 10 June 2013

SQL Query

sql Query, needs work.

       string sSQL_Sort = "SELECT PK_Attribute,CASE WHEN SUBSTRING_INDEX(Name, ' ', 1) IN ('a','an','the') THEN CONCAT(SUBSTRING(Name, INSTR(Name, ' ')+1), ', ', SUBSTRING_INDEX(Name, ' ',1)) ELSE Name END AS Name,min(FK_Picture) AS FK_Picture FROM " + sTable + " JOIN " +
               sTable + "_Attribute ON FK_" + sTable + "=PK_" + sTable + " JOIN Attribute ON " +
               sTable + "_Attribute.FK_Attribute=PK_Attribute AND FK_AttributeType=" + StringUtils::itos(PK_AttributeType_Sort) +
               " LEFT JOIN Picture_Attribute ON Picture_Attribute.FK_Attribute=PK_Attribute WHERE " +
               (sTable=="File" ? "IsDirectory=0 AND " : "") +
               "PK_" + sTable + " in (" + sPK_File_Or_Disc + ") GROUP BY PK_Attribute,IF(SUBSTRING(Name,1,4)='The ',SUBSTRING(Name,5),Name)";