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

Incorrect results from query... how to resolve it?

$
0
0

using the following query and getting the results shown below

Text
SELECT '000000' AS area, [SizeClassep], COUNT(*) AS [Number of Worksites], SUM(Employment) AS [Employment In Size Class] FROM dbo.xyzfirms201701 WHERE naicscode like '11%' or naicscode like '21%' and ownership ='50' GROUP BY [SizeClassep] ORDER BY [SizeClassep] 
Text
000000 01 306 519 000000 02 121 785 000000 03 94 1286 000000 04 52 1597 000000 05 20 1421 000000 06 13 1799 000000 07 5 1984 000000 08 4 2390 000000 09 3 5214 

Now when I take the data from SQL and put into excel, I get the following results. The last item below is the update that creates the field, sizeclassep. Previously, the field is more narrowly defined.

Text
000000 01 305 517 000000 02 118 768 000000 03 93 1269 000000 04 52 1597 000000 05 20 1421 000000 06 13 1799 000000 07 5 1984 000000 08 4 2390...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



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