sql: how to use count for a particular column ,(or) to count a particular column by its field name

Posted by Aravintha Bashyam on Stack Overflow See other posts from Stack Overflow or by Aravintha Bashyam
Published on 2012-11-02T04:51:51Z Indexed on 2012/11/02 5:00 UTC
Read the original article Hit count: 114

Filed under:

in my query i need a to count a particular column by its field name,

SELECT 
  C.INC_COUNT, MIN_X, MIN_Y, MAX_X, MAX_Y, B.STATE_ABBR,
  B.STATE_NAME, B.LATITUDE, B.LONGITUDE, A.STATE, GEO_ID, 
  concat(A.LSAD_TRANS,' ' , A.NAME) DIST_NAME, 
  A.LSAD, GeometryType(SHAPE) GEO_TYPE, AsText(SHAPE) GEOM  
from SHAPE_LAYERS A 
join SHAPE_LAYER_STATE_DESC B 
  on ( A.state = B.state) 
left outer join INC_DIST_SUMMARY_ALL C 
  on (C.SHAPE_GEO_ID = A. GEO_ID)

here i have to count by

 B.STATE_NAME ,C.INC_COUNT

if exmple the field name nevada means i have to get all neveda value count and the C.INC_COUNT.

© Stack Overflow or respective owner

Related posts about sql