开发者

YQL equivalent of MySQL's 'INTERVAL'?

开发者 https://www.devze.com 2023-02-11 16:54 出处:网络
I have a job postings board that I\'m running in PHP/MySQL and thinking of trying to run it in YQL and Google Docs instead. I have a line of MySQL that fetches job postings that have b开发者_JS百科een

I have a job postings board that I'm running in PHP/MySQL and thinking of trying to run it in YQL and Google Docs instead. I have a line of MySQL that fetches job postings that have b开发者_JS百科een posted in the last 60 days only:

$sql = "SELECT * FROM `job` WHERE Curdate( ) <= DATE_ADD( `postdate` , INTERVAL 60 DAY ) ORDER BY `postdate` DESC;";

Is there a YQL equivalent of this? (The format of the timestamp column in the spreadsheet of form submissions in Google Docs is:

2/11/2011 10:23:37


YQL doesn't currently have the option of custom functions within queries, so your Curdate(), DATE_ADD(), etc. are out of the question. However, there is no reason why you could not craft queries like:

SELECT * FROM job WHERE postdate > $date ORDER BY postdate DESC;

Where $date is an integer timestamp (if that is available in your Google doc?). Or,

SELECT * FROM job WHERE interval = 60; 

This latter query would need a bespoke Data Table to interpret the query parameter(s) and format a query against your Google doc. An advantage of crafting your own table would be that you are able to use JavaScript (in an <execute> block) to perform server-side processing (like one would in PHP) in YQL.

0

精彩评论

暂无评论...
验证码 换一张
取 消