Personal I am facing a question with a particular Query, I have already cataloged everywhere on the subject but without success. If there is another way to do what I'm trying, I'll thank you for the information
So, I'll illustrate the scenario.
TABLE VOUCHERS
InthistableIamassigningaserial_lotesincevoucherswillbegeneratedinlargequantities,eachvoucherhasanoverall_time.
Iwasabletocreateaquerywhereitreturnsalltheserial_lotethatwerecreatedinthelast2hoursandthetimesthatthislotrepeats.
SELECTserial_lote,Count(*)FROMvoucherswhere(data_criacaoBETWEENDATE_SUB(NOW(),INTERVAL2hour)ANDNOW())GROUPBYserial_loteHAVINGCount(*)>1orderbyserial_loteDESC
Ineedtogetbacknotonlytheserial_loteandthenumberoftimesthislotrepeats,butalsotheTotal_Timeofeachlot.(LotscanonlybecreatedwiththesameTotal_time)