php - select duplicate records where one record must contain the exact value -
i have table below 3 columns amount, frequency & identifier. these records in same table in same database.
amount frequency identifier 4.75 1 100 4.75 3 101 4.76 2 102 4.76 3 103 4.44 1 104 4.43 1 105 4.75 2 106 4.67 2 107 4.75 3 108 4.64 2 109 4.64 3 110 4.65 4 111
i'm after sql query should pickup duplicate records different frequency frequency of 1 of them must equal 1. output i'm expecting
amount frequency identifier 4.75 1 100 4.75 3 101 4.75 2 106 4.75 3 108
note query executed every 2 seconds along 15 other queries lightweight. can processing in php too, prefer database query long not performance intensive. i'm trying different queries, can't consistent results. can please ?
many thanks
i'm thinking fastest way want:
select * t exists (select 1 t t2 t2.amount = t.amount , t2.frequency = 1)
this run fastest index on (amount, frequency)
.
Comments
Post a Comment