question

ritu avatar image
ritu asked

command for storing result from a query to a temporary table in db2

select * into # tbl1 from( select * from tableA) above given query is used for storing result of single sql statement into a temporary table in SQL server .i want to know a same query but for DB2 Server
temporary-tabledb2
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

You may get an answer here, but you might be better served taking the question to a DB2 dedicated forum.
1 Like 1 ·

1 Answer

·
michaelchapman 7202 avatar image
michaelchapman 7202 answered
declare global temporary table Temp1 (pub_name varchar(7), maxprice numeric(8,2)) on commit preserve rows not logged ; insert into SESSION.Temp1 (pub_name, maxprice ) select pub_name, max(c_price) from book group by pub_name;
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.