1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| --Insert all data from the appropriate tables. Data should be ordered by CODE_NAME in reverse alphabetical orde
Insert into agentsinfotarget
(code_name, information_id, gleaned_date, first_name, last_name, description)
select code_name, information_id, gleaned_date,first_name,last_name, description
from
(select code_name, information_id, gleaned_date, t.first_name,t.last_name, l.description
from agents a
inner join information i
on a.agent_id= i.agent_id
inner join targets t
on i.target_id=t.target_id
inner join locations l
on t.location_id=l.location_id
order by code_name desc
) |