I hope this is the right category to post this question.

I use Visual Basic 6 and MySql. Some queries are slow and the database doesn't have more than 1200 records yet.

I make this simple query and it displays it in the grid.

Code:
"SELECT * FROM table1 ORDER BY num ASC"
Then, if I want to display a column containing a sum of the records linked to each of these elements, I need to open another separate query.

Code:
"SELECT COUNT(DISTINCT(id_registro)) as QTDE FROM table2 WHERE id_planoconta=" & id
Does anyone suggest a single MySql query for this situation?