Forum Discussion
Anonymous
7 years agoNot applicable
SQL Query with Actual Date
Hello, I Have a question. What must I write in the M Statement or SQL Statment to get WHERE explicit Date to NOW Date? Quelle = Odbc.Query("dsn=mmStatistik", "SELECT * FROM mmstatistik#(I...
- Anonymous7 years ago
SELECT * FROM mmstatistik WHERE belegdatum BETWEEN {d '01/01/2018'} AND Date()was rellay simple...and a lucky type...
that works and gives me the actual date
Thanks for alle the help and sorry for the circumstances.
Anonymous
7 years agoNot applicable
Hey Anonymous,
You can use something like :
Table.SelectRows(#"Name of Previous Step", each [#"Column Name to Filter"] = DateTime.LocalNow())
*Technically it returns a Date/Time value, where TODAY() returns a Date value. The literal closest to TODAY() is Date.From(DateTime.LocalNow()) which you should use rather than DateTime.LocalNow() alone if the column you're filtering is already a plain date type rather than date/time.*
- Anonymous7 years agoNot applicable
And if i want to place it in the SQL Query?
SELECT * FROM mmstatistik WHERE belegdatum >= {d '01/01/2018'} AND <= DateTime.Date(DateTime.LocalNow())- DaFloDo7 years agoResolver I
Hi Anonymous,
try
= "SELECT * FROM mmstatistik WHERE belegdatum >= {d '01/01/2018'} AND belegdatum <= '" & Date.ToText(DateTime.Date(DateTime.LocalNow())) &"'"Quelle = Odbc.Query ( "dsn=mmStatistik", "SELECT * FROM mmstatistik WHERE belegdatum >= {d '01/01/2018'} AND belegdatum <= '" & Date.ToText(DateTime.Date(DateTime.LocalNow())) &"'" )regards
florian