如何获得最后一个mpnth事务 [英] how to get last one mpnth transactios
本文介绍了如何获得最后一个mpnth事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在该数据库中获得上个月的交易以及如何使用该查询以及如何在gridview中进行绑定
how to get last one month transaction in that database and how to use that query and how to bind in gridview
推荐答案
尝试:
SELECT * FROM myTable WHERE transDate BETWEEN startDate AND endDate
SELECT * FROM mytable WHERE MONTH(transDate)=month AND YEAR(transDate)=presentYear
如果您经常执行该查询,那么我还将月份和年份存储在该数据库的其他列中(使用触发器在插入/更新记录时插入/更新值).
If that''s a query you do often, I''d also store month and year in extra columns in that database (use a trigger to insert/update the values when a record gets inserted/updated).
嗨
您可以从此查询中获取
hi
u can get from this query
SELECT * FROM tablename WHERE MONTH(DateColumnName)=MONTH(getdate())-1 AND YEAR(DateColumnName)=Year(getdate())
这篇关于如何获得最后一个mpnth事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文