risolto
REGEXP_REPLACE here:, Note that in either case we pass g as the fourtb parameter to REGEXP_REPLACE to do a global replacement of all pipe separated numbers.
quindi aggiungiamo
Codice:
REGEXP_REPLACE(movies.year,'(-|\?)','', 'g') as anno,
e raggruppiamo per anno
Codice:
SELECT DISTINCT
REGEXP_REPLACE(movies.year,'(-|\?)','', 'g') as anno,
COUNT ( movies.year ) AS conteggio
FROM
actors
LEFT JOIN movies2actors ON actors.actorid = movies2actors.actorid
LEFT JOIN movies ON movies2actors.movieid = movies.movieid
WHERE
actors.actorid = $actor_id
GROUP BY
anno
";
risultato finale
Buon Anno a tutti