sql – Attach subquery with several fields to a main query

I need to attach the query that a user throws to a statistics report about long-term queries in Amazon Redshift (based on PostgreSQL). These are obtained in the following way:

select query as idquery, wlm_start_time as start, queue_time as
time_in_cola_microseg, exec_time as tiempo_ejecucion_microseg,
(time_in_cola_microseg + time_ejecucion_microseg) as tiempo_total_microseg
state, state
mod (cast (floor (total_time_microseg / 3600000000) as integer), 24) || ':' ||
mod (cast (floor (total_time_microseg / 60000000) as integer), 60) || ':' ||
mod (cast (floor (total_time_microseg / 1000000) as integer), 60) as
case time_total_microseg
when time_total_microseg> 28800000000
then 'CRITICAL' else 'WARNING'
end as situation
from stv_wlm_query_state
where time_total_microseg> = 14400000000
order by duracion_hhmmss;

Now, I need to take the field query and search all the text (the select itself) in another table:

select * from stl_querytext where query = 1319600;

The problem is that this last query yields the following result:

enter the description of the image here

That is to say, the sentence divides it into several sequences. I need the whole query to appear in a single field, to attach it to the query above, since that result is exported in .CSV

In what way could I do it?