1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SOQLのサンプル

Last updated at Posted at 2022-06-07

文字列変数を使う ポイントは :

String kyoten ='006';
List<KojiDaicyo2__c> KojiDaicyo2List = [select Id,Name,KaishiDate__c, from KojiDaicyo2__c where KaishiDate__c <= YESTERDAY AND Eigyousyo__c Like :kyoten + '%'  ];
system.debug(KojiDaicyo2List);     

このパターンでは相対日付は使えないと思っていましたが、大丈夫でした。ただの文字列として認識されている感じです。

String mySOQL2 = mySOQL + ' KaishiDate__c <= YESTERDAY AND Eigyousyo__c Like \'006%\' order by Tantousya__r.Name';
List<KojiDaicyo2__c> KojiDaicyo2List = Database.query(mySOQL2);

参考資料

日付形式と日付リテラル

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?