soql查询得到整个月,除了最后一周
soql query to get whole month,except its last week
我想查询一个月的记录,除了那个月的去年。
我的 soql 查询是这样的
select id,name from opportunity where CreatedDate=THIS_MONTH And WEEK_IN_MONTH IN (1,2,3)
soql 查询以获取除最后一周以外的整个月。
你把它标记为顶点所以你可以作弊吗?
Date today = System.today();
Integer cutoff = Date.daysInMonth(today.year(), today.month()) - 7;
System.debug([SELECT Id
FROM Opportunity
WHERE CreatedDate=THIS_MONTH AND DAY_IN_MONTH(CreatedDate) < :cutoff]);
我想查询一个月的记录,除了那个月的去年。 我的 soql 查询是这样的
select id,name from opportunity where CreatedDate=THIS_MONTH And WEEK_IN_MONTH IN (1,2,3)
soql 查询以获取除最后一周以外的整个月。
你把它标记为顶点所以你可以作弊吗?
Date today = System.today();
Integer cutoff = Date.daysInMonth(today.year(), today.month()) - 7;
System.debug([SELECT Id
FROM Opportunity
WHERE CreatedDate=THIS_MONTH AND DAY_IN_MONTH(CreatedDate) < :cutoff]);