@Vincent Decaux Thanks for the example you provided.
I'm having trouble modifying it for my needs.
The SQL in particular I can't get my head around. I have this but it's not working...
$searchQueryBuilder->leftJoin(
'c',
'`' . pSQL(_DB_PREFIX_) . 'customer`',
'pa',
'pa.`id_customer` = c.`id_customer`
= (
SELECT
pa2.`agecheck`
FROM
`'. pSQL(_DB_PREFIX_) .'customer` pa2
WHERE pa2.`id_customer` = pa.`id_customer`
ORDER BY LENGTH(pa2.`agecheck`) DESC
LIMIT 1
)'
);
The field I'm trying to get is in ps_customer and is called agecheck.
Im guessing it might not need the "leftJoin" part ?
Any chance you could point me in the right direction
Thanks
Ray