I'm trying to figure out how to do a google query for dates in the last 30 days. I'm using a wordpress plugin that lets you display spreadsheet data and do queries.
Here is the current working query
query="SELECT B,N,E,G,H,I WHERE A='Exited Positions Bullish Stocks'"
And here is the one I'm trying that just doesn't work.
query="SELECT B,N,E,G,H,I WHERE A='Exited Positions Bullish Stocks' and G>NOW()-30"
This is inside a shortcode in WordPress, so I don't think that the formatting is exactly the same as in Google. Here is a working example:
[gdoc key="https://docs.google.com/a/justinhandley.com/spreadsheets/d/15q2H_X0nohUJs8vgZ6NFiHrtU5lBKrEQLM1dJoQgB6E/edit" gid="2078888428" class="no-datatables" query="SELECT B,N,E,G,H,I WHERE A='Exited Positions Bullish Stocks' "]
Based on answers below, I have tried...
[gdoc key="https://docs.google.com/a/justinhandley.com/spreadsheets/d/15q2H_X0nohUJs8vgZ6NFiHrtU5lBKrEQLM1dJoQgB6E/edit" gid="2078888428" class="no-datatables" query="SELECT B,N,E,G,H,I WHERE A='Exited Positions Bullish Stocks' "]
Which works (but doesn't filter by date) and can be seen at
http://leibovitvrnewsletters.com/portfolio-test-1/
[gdoc key="https://docs.google.com/a/justinhandley.com/spreadsheets/d/15q2H_X0nohUJs8vgZ6NFiHrtU5lBKrEQLM1dJoQgB6E/edit" gid="2078888428" class="no-datatables" query="('VR Platinum'!A:N, "SELECT * WHERE A='Exited Positions Bullish Stocks' AND G >= date '" & TEXT(NOW()-30, "yyyy-MM-dd") & "' ") "]
Which copies the query below, but doesn't work (doesn't sort by anything, seems to return entire list of everything) and can be seen at
/portfolio-test-2/
[gdoc key="https://docs.google.com/a/justinhandley.com/spreadsheets/d/15q2H_X0nohUJs8vgZ6NFiHrtU5lBKrEQLM1dJoQgB6E/edit" gid="2078888428" class="no-datatables" query="SELECT B,N,E,G,H,I WHERE A='Exited Positions Bullish Stocks' AND G >= date '" & TEXT(NOW()-30, "yyyy-MM-dd") & "' "]
Which just totally breaks, and can be seen at
/portfolio-test-3/
Any help putting this together is much appreciated.