skip to Main Content

Delete duplicates with condition – Mysql

I have the table contacts which contains duplicate records: id name is_contacted created_at I need to delete duplicates, but keep the first record(among the duplicates for each name) where is_contacted=1. If among the record duplicates there are no records where…

VIEW QUESTION

Optimize QUERY JOIN – Mysql

I'm working on a transport program that forces me to create a long query to search for possible routes. I need to optimize the query as much as possible. It calculates stopovers between bus stops. People get off at one…

VIEW QUESTION

can someone help me simplify this syntax – Mysql

can someone help me make it simple and fast? select k1.sto, k1.mm,k1.dd, k1.yy, k1.sto_name, k1.trannum, count(k2.barcode) from trans012020 as k1 , trans012020 as k2 where k1.barcode=123456789 and k1.mm=k2.mm and k1.dd=k2.dd and k1.yy=k2.yy and k1.sto=k2.sto and k1.trannum=k2.trannum group by k1.trannum having…

VIEW QUESTION
Back To Top
Search