Skip to content
Advertisement

SQL join results from GROUP BY and COUNT in 2 tables

Table 1 (VID is unique)

To count the records by UID,

Table 2 (which is a subset from table 1)

To count the records by UID after mapping with table 1,

Now can I join these 2 result tables together, based on 2nd result with 1 SQL such that the results are:?

What if I want to join an extra table which contains info for UIDs:

such that results are:?

Advertisement

Answer

Try below query to get desired result.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement