Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Selective sorting based on number of results in SQL

$
0
0

First section of code is what I am trying followed by the error code. The second section is what I have been using successfully. The purpose of this is to have it list number of employers for a given area and industry (indcode). I have been tasked with limiting the visible records to only those that are 5 or greater. This query is being used in tableau but it yields nothing in SSMS.

Text
Select state,areatype,area,codetype,indcode,COUNT (indcode) AS Employers Into #temptable2 From firms Group by state,areatype,area,codetype,indcode ; Select * from #temptable where employers =5; [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'Into'. [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ')'. 
Text
SELECT state, areatype, area, codetype AS codetyp, indcode, 'S' AS indsource,...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>