It is definitely doable. I don't know how much help you need and experience with SQLite, but here is a starting point to give you an idea how to approach the process by dis[laying the data in the logs. No CLVExpandable code in the below code:
If you create a small project and use this code, it will give you all the data you need . The result from rs1 gives you the title of each panel. The results from rs gives you the data when you expand the title. Again, the aggregate results of the 2 queris is what you need. Give your self a chance to incorporate the results in you xCLVExpandable. If you get stuck, get ask questions to all members, not just one or two members. If I am not available to answer, the rest of the members are a lot more qualified to give a helping hand. But I gave you the foundation for the data you need. If you plan to pursue the project, do not use PCLV, use lazy loading or no lazy loadin as you were advised
Dim strQuery As String
Dim rs1 As ResultSet
strQuery = $"SELECT DISTINCT surn FROM names ORDER BY surn "$
rs1 = SQL.ExecQuery2(strQuery, Null )
Do While rs1.NextRow
Dim mysurname As String = rs1.GetString("surn") 'this will be the title
Dim rs As ResultSet = SQL.ExecQuery2($"SELECT A.surn AS Surname, A.givn AS Fullname, B.sex AS Sex FROM persons B
JOIN names A ON B.id = A.id_p WHERE Surname LIKE ?
ORDER BY Surname "$ _
, Array As String (mysurname))
Do While rs.NextRow
Log($"${rs.getstring("Surname")}${TAB}${rs.getstring("Fullname")} ${TAB}${rs.getstring("Sex")}"$)
Loop
rs.Close
Loop
rs1.Close
By the way the database is relatively good except that you have some records that have more than one id. But, this is a working database and not your official one. Good luck.