Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Last active February 24, 2020 20:46
Show Gist options
  • Save jamescalam/abfe4cc4dd51ef96f0de13a1deae838c to your computer and use it in GitHub Desktop.
Save jamescalam/abfe4cc4dd51ef96f0de13a1deae838c to your computer and use it in GitHub Desktop.
def union(self, table_list, name="union", join="UNION"):
# initialise the query
query = "SELECT * INTO ["+name+"] FROM (\n"
# build the SQL query
query += f'\n{join}\n'.join(
[f'SELECT [{x}].* FROM [{x}]' for x in table_list]
)
query += ") x" # add end of query
self.manual(query, fast=True) # fast execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment