dimanche 20 décembre 2015

Find unique values from records that contain duplicate values in a different field

I am trying to return all value of the_id that have been received within the past 8 days and there is at least 1 duplicated name. This should return 1,5.

MYTABLE

SELECT the_id, count(*) c FROM "MYTABLE" WHERE "received" < date('now','-8 days') GROUP BY the_name HAVING c > 1;

Aucun commentaire:

Enregistrer un commentaire