Date Queries for MapBasic

14 views
Skip to first unread message

Shaun Blackmore

unread,
Jun 21, 2021, 10:48:44 PM6/21/21
to MapInfo-L
Hi,

I'm trying to query an date column within MapInfo to show the results of the last 5 years. I want to run an MapBasic scripts for this query to save time.  

For example, I have a date  column  I want to query from the current date (today) to show results for the last 5 years to run as a MapBasic  scripts.

I'm new to MapBasic to any help would be grateful. 

Thanks,

Shaun

Timothy Mashford

unread,
Jun 21, 2021, 11:00:15 PM6/21/21
to mapi...@googlegroups.com
Hi Shaun,

Something like:

Dim dFrom, dTo As Date

dTo = CurDate()
dFrom = dTo - (365*5)

Select * From my_table Where date_col Between dFrom and dTo Into Last_5yrs NoSelect
Browse * From Last_5yrs

....


Tim

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/80e8848b-42ed-4179-b860-c77b22a99a93n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages