Page 1 of 1

Sql Query

PostPosted: Mon Jun 19, 2017 12:34 am
by bypass666
Hi all

does anyone know a way to successfully run this syntax in DBPro?

SELECT * FROM Workorders
WHERE (DateReceived BETWEEN #[DateQuery1]# AND #[DateQuery2]#)
AND (ModelNumber LIKE [TextEntry42]);

I've tried multiple ways however it just doesn't seem to like it. It seems to be when i enter the second AND.

Many thanks

Re: Sql Query

PostPosted: Mon Jun 19, 2017 7:13 am
by dpayer
If your date is stored in MySQL format (YYYY-MM-DD) you should be able to query with something like:

SELECT * FROM Workorders
WHERE ((DateReceived > #[DateQuery1]#) AND (DateReceived < #[DateQuery2]#))
AND (ModelNumber LIKE [TextEntry42]);

Re: Sql Query

PostPosted: Mon Jun 19, 2017 7:54 am
by virger
Usando DateRec.. con formato dd/mm/yyyy, funciona para mi.
Ussing DateRec.. with format dd/mm/yyyy, works for me.

Re: Sql Query

PostPosted: Mon Jun 19, 2017 8:10 am
by virger
Disculpe/Sorry
Esto es lo correcto/This is the correct

Usando DateRec.. con formato yyyy/mm/dd, funciona para mi.
Ussing DateRec.. with format yyyy/mm/dd, works for me.

Re: Sql Query

PostPosted: Mon Jun 19, 2017 9:03 am
by bypass666
Thanks for the answers guys although i did manage to solve the issue earlier today. The format was MS Access Date.

Inside the DbpExecSQL dialog window:

SELECT * FROM WorkOrders WHERE
DateReceived BETWEEN #[DateQuery1]# AND #[DateQuery2]#
AND ModelNumber LIKE "[TextEntry42]"

This works just fine, thanks again for the info.