Extending result of a SQL query to show some 'empty' years

54 views
Skip to first unread message

Ross Nixon

unread,
Oct 18, 2023, 1:26:35 AM10/18/23
to MapInfo-L
Some of my table queries (using 'Group by') return results such as the following:

YEAR  AREA
2000   51
2002   37
2005   49

I wish to get the following result:
1999    0
2000   51
2001     0
2002   37
2003     0
2004     0
2005   49

At the moment I'm exporting the query result to a spreadsheet and fiddling there to add the missing years. Is there a good way that I can do this within MapInfo?

Thanks
Ross

Sergi Gàmiz Ribelles

unread,
Oct 31, 2023, 7:18:36 AM10/31/23
to MapInfo-L
Hi Ross, please can you show us your SQL query? Thank you.
SGR
El dia dimecres, 18 d’octubre de 2023 a les 7:26:35 UTC+2, Ross Nixon va escriure:

Ross Nixon

unread,
Nov 13, 2023, 9:28:50 PM11/13/23
to MapInfo-L
I have got a work-around. It involves temporarily adding 'dummy data' points to my table before doing the queries, and deleting them when I'm done. My dataset was quite large so there were thousands of rows to add. Took a long time to make in a spreadsheet - if only I knew some Python. I used the 'year' as both X & Y coordinates.
Reply all
Reply to author
Forward
0 new messages