ProtyayMnd50 revised this gist . Go to revision
1 file changed, 8 insertions, 6 deletions
query.txt
@@ -1,12 +1,14 @@ | |||
1 | 1 | SELECT | |
2 | - | c.GroupID, | |
3 | - | c.CompanyName, | |
2 | + | m.GroupID, | |
3 | + | v.CompanyName, | |
4 | 4 | COUNT(*) AS Count | |
5 | 5 | FROM | |
6 | - | cb_vendorinformation v | |
6 | + | maintable_PCDRE m | |
7 | 7 | JOIN | |
8 | - | companies c ON v.GroupID = c.GroupID | |
8 | + | cb_vendorinformation v | |
9 | + | ON | |
10 | + | m.GroupID = v.GroupID | |
9 | 11 | GROUP BY | |
10 | - | c.GroupID, c.CompanyName | |
12 | + | m.GroupID, v.CompanyName | |
11 | 13 | ORDER BY | |
12 | - | Count ASC, c.GroupID DESC; | |
14 | + | Count ASC, m.GroupID DESC; |
ProtyayMnd50 revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
query.txt
@@ -9,4 +9,4 @@ JOIN | |||
9 | 9 | GROUP BY | |
10 | 10 | c.GroupID, c.CompanyName | |
11 | 11 | ORDER BY | |
12 | - | Count DESC, c.GroupID ASC; | |
12 | + | Count ASC, c.GroupID DESC; |
ProtyayMnd50 revised this gist . Go to revision
1 file changed, 12 insertions
query.txt(file created)
@@ -0,0 +1,12 @@ | |||
1 | + | SELECT | |
2 | + | c.GroupID, | |
3 | + | c.CompanyName, | |
4 | + | COUNT(*) AS Count | |
5 | + | FROM | |
6 | + | cb_vendorinformation v | |
7 | + | JOIN | |
8 | + | companies c ON v.GroupID = c.GroupID | |
9 | + | GROUP BY | |
10 | + | c.GroupID, c.CompanyName | |
11 | + | ORDER BY | |
12 | + | Count DESC, c.GroupID ASC; |