Pull parts of a query from separate file?


I have this long and involved query that I need to use for many tasks. Currently I copy and paste the top part of the query. Unfortunately there are now many versions. I want to park the query in one location and reference it from my other queries.

Does Datagrip provide a way for me to do this?


Here is the form of my query:

with loc_remap as (

/*This select statement is long and involved and I sometimes make fat fingered mistakes. It also is useful in many queries and I want to put it in a file where it is available but out of the way. */
select * from locations


/*This select statement can vary and I want it in my active file.*/

select * from loc_remap


1 comment
Yuriy Vinogradov

Query Book in DataGrip

hope this helps.


Please sign in to leave a comment.