How can MySQL retrieve rows with duplicate values?


If the number of rows in the group is greater than 1 after grouping by this field, it is a duplicate row. Greater than 1 needs to be written into "having"; but only use group + having can only get the aggregate value, not the detailed data. To get the details, repeated traversal with subquery is needed:

select *
from A
where g in
       (select  g
       from A
       group by g
       having count(*)>1)

SQL has no explicit set data type, so it can't keep the subset after grouping, and then it can't perform subsequent multi-step operations on the subset, so it has to use a lengthy sub query.

This kind of set operation is more convenient with esProc SPL, as long as one line:>1).conj()

With an explicit set, you can perform more complex subsequent calculations on the grouped subsets, including enumeration grouping, overlapping grouping, etc. Please refer to  SPL grouping

SPL statements cannot be executed directly in the database. Raw data can be obtained from the database, Excel and text through the following statements:

>T1=connect(”mysqlDB”).query(“select * from t”)

It's also easy to embed esProc into Java applicationsplease refer to How to Call an SPL Script in Java

For specific usage, please refer to  Getting started with esProc