A, An, The

From LinuxMCE
Revision as of 03:49, 10 June 2013 by Tschak909 (Talk | contribs) (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...")

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

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)";