[TYPO3-dev] MySQL First Letter and Umlauts
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Fri Oct 26 16:07:05 CEST 2007
Steffen Kamper schrieb:
> Hi,
>
> i need a tip for an alphabetic List in mySQL (all in utf8).
>
> I did this (for drwiki)
> SELECT DISTINCT keyword,ASCII(UPPER(SUBSTRING(keyword,1,1))) letter FROM
> `tx_drwiki_pages` ORDER BY letter
May I ask why you need the ASCII? UPPER(LEFT(keyword,1)) will already
get you the letter. I fail to see the point, but maybe COLLATE is your
friend:
ORDER BY letter COLLATE latin1_german2_ci;
Strictly speaking there is no ASCII value für umlauts anyway as true
ASCII uses only 7-bit (max. number 127). But maybe it helps is you cast
the value from utf8 to latin before you apply the ASCII:
ASCII(CONVERT(UPPER(LEFT(keyword,1)) USING latin1));
Masi
More information about the TYPO3-dev
mailing list