[TYPO3-mvc] how to search part of a string ( WHERE LEFT(code, 1) )
Stefano Cecere
scecere at krur.com
Mon Mar 26 11:10:33 CEST 2012
silly me
i solved by querying: $query->like('code', $q . '%')
thank you :)
s
On Mon, 26 Mar 2012 10:06:14 +0100, Stefano Cecere <scecere at krur.com>
wrote:
> hi
>
> while it's ok to search a string $q in field 'code' by
> $query->like('code', '%' . $q . '%')
> how can i search by first letter of 'code' ?
>
> by raw mysql i would do fast by WHERE LEFT(code,1) = 'k'
>
> but if i query with $query->equals('LEFT(code,1)', $q ) i get lot of
> errors :)
>
> is it possible with standard Extbase query engine, or should i bypass it
> (in this case i would save the first letter of 'code' in a separate
> field by TCE hook)?
>
> thank you
>
>
--
____ ___ __ _ ______________________
Stefano Cecere
KRUR studio
More information about the TYPO3-project-typo3v4mvc
mailing list