Skip to content
Advertisement

Regarding SQL Inner Join [closed]

The question is as follows :

My question is regarding SQL code for the following question.

Final query should return the vendor information along with the values from the table cb_vendorinformation.

You should combine the values of the two tables based on the GroupID column.

The final query should only print out the GroupID, CompanyName, and final count of all rows that are grouped into each company name under a column titled Count.

The output table should be then sorted by the Count column and then sorted by GroupID so that a higher number appears first.

This is the main table :

maintable

The output should look like this :

finaloutput

I could develop a code as follows but I am not getting the correct output :

My output :

my output

Expected output :

expected output

Could someone please help me out here ?

I tried this code :

And was getting the output as follows :

Output2

Advertisement

Answer

Why don’t you just use ORDER BY as follows:

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