Welcome! Log In Create A New Profile

Advanced

WD 23 - Search by date from - to query?

Posted by infos 
WD 23 - Search by date from - to query?
November 14, 2019 05:40PM
Search by date from - to query?

When I set the "is included between" (parameter to query editor1 - Date from), (parameter2 - Date to), do I not get the required result?

How to ask this query correctly?

What type of query do I use when I want to search data between two dates?

[infosonline.net]



Edited 3 time(s). Last edit at 11/14/2019 05:46PM by infos.
Peter Holemans
Re: WD 23 - Search by date from - to query?
November 14, 2019 06:14PM
Hi Infos,

In WX SQL this would be simply

WHERE DateField BETWEEN {WDDateFrom} AND {WXDateTo}

So check your query in SQL syntax in teh query editor (right click if I recall correctly).
The whole world knows and uses SQL as the main standard so it's best to maintain your queries in SQL syntax in WX.
Specially with a lot of inner and outer joins WX translates it into really weird and unreadable SQL statements sometimes.
Always use SQL in teh query editor in that case.

Note that you always need to complete both parameters in this case, otherwose one will translate as NULL by the runtime.

That should do it.

Peter Holemans
Re: WD 23 - Search by date from - to query?
November 14, 2019 09:05PM
Hi Peter

I wonder why the WD Query editor doesn't have a solution for this kind of query, or just how to ask? I tried several options and neither option provided a solution.
Also, WD does not support standard SQL code ?!

[infosonline.net]
Re: WD 23 - Search by date from - to query?
November 15, 2019 09:15AM
Infos

I use that all the time and works as expected, hfsql and mssql as well.
There must be wrong something else. How do you pass the dates to the query?
You should use the format YYYMMDD

Arie
Re: WD 23 - Search by date from - to query?
November 15, 2019 06:26PM
Solution

The Date field must be an index field

Then the query works fine

Thank you

[infosonline.net]
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: