<p>I’m trying to run this SQL using get external.</p>

<p>It works, but when I try to rename the sub-queries or anything for that matter it remove it.</p>

<p>I tried <code>as</code>, <code>as</code> and the name in <code>''</code>, <code>as</code> then the name in <code>""</code>,
 and the same with space. What is the right way to do that?  </p>

<p>Relevant SQL:</p>

<pre><code>SELECT list_name, app_name, 
    (SELECT fname  + ' ' + lname  
     FROM dbo.d_agent_define map 
     WHERE map.agent_id = tac.agent_id) as agent_login, 
   input, CONVERT(varchar,DATEADD(ss,TAC_BEG_tstamp,'01/01/1970'))
FROM dbo.maps_report_list list 
JOIN dbo.report_tac_agent tac ON (tac.list_id = list.list_id)
WHERE input = 'SYS_ERR' 
   AND app_name = 'CHARLOTT'
   AND convert(VARCHAR,DATEADD(ss,day_tstamp,'01/01/1970'),101) = '09/10/2008'
   AND list_name LIKE 'NRBAD%'
ORDER BY agent_login,CONVERT(VARCHAR,DATEADD(ss,TAC_BEG_tstamp,'01/01/1970'))
</code></pre>

You could get rid of your
```
dbo.d_agent_define
```
subquery and just add in a join to the agent define table.
Would this code work?
```
```
select list_name, app_name, 
map.fname + ' ' + map.lname as agent_login, 
input, 
convert(varchar,dateadd(ss,TAC_BEG_tstamp,'01/01/1970')) as tac_seconds
from dbo.maps_report_list list 
join dbo.report_tac_agent tac 
on (tac.list_id = list.list_id) 
join dbo.d_agent_define map
on (map.agent_id = tac.agent_id)
where input = 'SYS_ERR' 
and app_name = 'CHARLOTT' 
and convert(varchar,dateadd(ss,day_tstamp,'01/01/1970'),101) = '09/10/2008' 
and list_name LIKE 'NRBAD%' 
order by agent_login,convert(varchar,dateadd(ss,TAC_BEG_tstamp,'01/01/1970'))
```
```
Note that I named your dateadd column because it did not have a name.  I also tried to keep your convention of how you do a join.  There are a few things that I would do different with this query to make it more readable, but I only focused on getting rid of the subquery problem.
I did not do this, but I would recommend that you qualify all of your columns with the table from which you are getting them.