
select date_scanned,source_id,count(*),max(timestamp) - min(timestamp) as sec from ffzg_inventura group by date_scanned,source_id;

select min(date_scanned),max(date_scanned),source_id,count(*) from ffzg_inventura group by source_id;

-- duplicates

select barcode,min(date_scanned),max(date_scanned),count(*) from ffzg_inventura group by barcode having count(barcode) > 1 ;

-- lastdeteseen to update
select ffzg_inventura.barcode,itemnumber,count(*),datelastseen,max(date_scanned) from ffzg_inventura join items on items.barcode = ffzg_inventura.barcode group by ffzg_inventura.barcode having datelastseen < max(date_scanned);

