数据库A中有表B,表B的C字段是城市,我想查询表B的C字段中所有上海市的数量,应该如何写查询语句?

解决方案 »

  1.   

    select count(1) from B where c='上海市'
      

  2.   

    SELECT COUNT(*) FROM TABLEB WHERE CITYNAME='上海市'
      

  3.   

    SELECT COUNT(*) FROM TABLEB WHERE CITYNAME='上海市'
      

  4.   

    select count(1) from B where c='上海市'
      

  5.   


    Select count(1) from B where C='上海市'
    ??
      

  6.   

    select count(*) as 数量
    from b
    where c='上海'
    --0r
    select count(*) as 数量
    from b
    where charindex('上海',c)>0