Hi,
I have recreate your two table to show how to make subtables/nested tables to works.
This are your tables:
As you can see there is a Foreign Key in table WorkshipSongDates point to WorkshipSongs table:
SongID->Song_ID
Main table is WorkshiptSong
Now in Wappler Database Query Builder when you add a table you will see the two tables, when table name have not an underscore to difference from main table and subtables that have foreign key, Wappler will show with a slash as a separator character “/”, in this case “/ Dates”:
The next is to add the main table: WorkshipSongs
, and you will see now the nested table as Dates
(WorkshipSongDates)
Now you can add the desired columns into the builder even the nested table, it get automatically an Alias with same name of the nested table.
At this point you can make double clic in the nested table and it will open a new pop-up windows of the nested table, in this point you can add in this nested table in “Aggregate Column” the COUNT event, without forget to add an “Alias”
Finally in the UI you can add inside your tableRepeat the “Alias” of the nested table that have a COUNT, in this case songCount, now in the binding area your will see this:
Dates[0].songCount
This will not send all data in query, just the COUNT of the nested table.
I hope this helps you.