• 查询


    --查消费金额
    select
    convert(varchar(7),exp_date,111) as 月份,
    count(exp_item) as 消费计数,sum(exp_price*exp_count) as 花费金额
    from
    tbl_expend
    where
    convert(varchar(7),exp_date,111) between '2019/09' and '2019/09'
    and exp_valid = 1 and exp_public =1
    group by convert(varchar(7),exp_date,111)

    --查收款数及金额
    select
    distinct inc_source,convert(varchar(7),inc_date,111) as 月份,count(inc_amount) as 收款次数,sum(inc_amount) as 收款金额
    from tbl_income
    where
    convert(varchar(7),inc_date,111) between '2019/09' and '2019/09'
    and inc_valid = 1 and inc_public = 1
    group by convert(varchar(7),inc_date,111) ,inc_source


    --查分类
    select
    distinct exp_type as 物品类型 ,count (exp_type) as 次数,sum(exp_price*exp_count) as 金额
    from
    tbl_expend
    where
    convert(varchar(7),exp_date,111) between '2019/09' and '2019/09'
    and exp_valid = 1 and exp_public =1
    group by exp_type

    union all
    select '合计'as 物品类型, 1 as 次数,sum(exp_price*exp_count) as 金额
    from
    tbl_expend
    where
    convert(varchar(7),exp_date,111) between '2019/09' and '2019/09'
    and exp_valid = 1 and exp_public =1


    alter table tbl_income add inc_method varchar(50) not null default ''

    --alter table tbl_income drop column inc_method
    --删除列

  • 相关阅读:
    python深浅拷贝
    软件开发目录规范
    编码规范
    python进程、线程、协程的介绍及使用
    soket粘包问题及解决方案
    python socket通信
    数据开发_机器学习
    数据开发_开发工具以及工具链
    数据开发_Python读取文件
    数据开发_Java设计模式_IO以及读取资源文件
  • 原文地址:https://www.cnblogs.com/bamboo-140/p/11512637.html
Copyright © 2020-2023  润新知