一开始是这样写的:
m_query.Format("select * from PAYOUT where Month([date]) = Month(#%s#) order by date,id asc",strToday);发现查询出的结果只按月,不按年,比如说,查12月的记录,会同时出现2008年12月和2009年12月的记录
现在想要以"2009-12"这种形式进行查询,请问怎么写?
m_query.Format("select * from PAYOUT where Month([date]) = Month(#%s#) order by date,id asc",strToday);发现查询出的结果只按月,不按年,比如说,查12月的记录,会同时出现2008年12月和2009年12月的记录
现在想要以"2009-12"这种形式进行查询,请问怎么写?
order by convert(nvarchar(6),日期,120)
少写了一点,呵呵。