Pull parts of a query from separate file?

Answered

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

Thanks,
Matt

0
1 comment
Avatar
Yuriy Vinogradov

Query Book in DataGrip

hope this helps.

0

Please sign in to leave a comment.