简体   繁体   中英

Can I make a temp table with other temp tables

I'm wondering if I can pull together the data from my other temp tables.

I need to be able to run a report for many different people from different departments and then aggregate the data so that I have individual reports, a larger picture of each department, and the entire floor including all departments to get the big picture. I have all the associates id #'s but I will need to separate each associate and department with their different "roles" in the company and most all have multiple roles assigned to them in the database.

So to avoid running a report for each associate, department, security role, function role, and the different task matrix that is important for them (# of calls, emails, task a, b, c, and pass through process az) which all depends on the person, etc., I created temp tables for some of the most important for all and will tie in the rest. To avoid having to change the date range of the report every time I pull it, I was hoping to aggregate the temp tables and change the date just the once in the aggregated temp table. Then I can run the query with the rules I need.

  • No join will work across all tables.
  • All tables need to be separate so no (union, cross join, or any table joins until the associate/department/role level if needed)
  • 5 temp tables each with 3 indexed columns from the table (requestid, userid, createDT, except for 2(calls & users), maybe more columns later.

Example:

`tmp.notes`; (requestid, userid, createDT)
`tmp.custcont`; (customer contact), (requestid, userid, createDT)
`tmp.emails`; (requestid, userid, createDT)
`tmp.calls`; (requestid, agent_id(= to users username, createDT)
`tmp.users`; (id, personid, username)

Once you've created a temporary table, you can use it as you would any other table. Therefore, you can almost certainly do what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM