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:
=A.group(g).select(~.len()>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”)
>T2=file(“d:/t.xlsx”).xlsimport()
>T3=file(“d:/t.csv”).import(;,",")
It's also easy to embed esProc into Java applications,please refer to How to Call an SPL Script in Java
For specific usage, please refer to Getting started with esProc
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL