How does php check whether a database field is a unique order database?
Id dan money
01 0001a 5
02 0001a 5
03 0001a 5
04 0001b 5
05 0001c 5
How can I check whether an order number is duplicated?
If all data is listed
For example, the upper column
List
01 0001a 5
02 0001a 5
03 0001a 5
How do I write mysql statements?
Reply to discussion (solution)
Select * from tt t where exists (select 1 from tt where dan = t. dan and id! = T. id );
It should be about the database: oracle: select * from t where dan in (select dan from t where having count (dan)> 1 group by dan ).
Well, SELECT * from ssc_record WHERE types = 7 and dan1 in (SELECT dan1 from ssc_record group by dan1 HAVING count (1)> 2)
In this way, the query is slow. if the data volume is large, it will not change.
Select id, dan, money, count (*) as num from ssc_record group by dan having num> 1