Selecting x columns but only displaying y columns

I have a SELECT JOIN where I need to use some of the columns in the WHERE clause but I don't want to see those columns in the output. How do I do that?

What do you have so far?

Here you go:

SELECT TAPE, SLOT FROM TABLE1 AS T1
LEFT JOIN (SELECT TAPE, DATETIME, SETS, STATUS FROM TABLE2 AS T2)      
AS T2 ON T2.TAPE = T1.TAPE WHERE T2.SETS='XYZ' AND T2.STATUS='A';  

The resulting display has the TAPE field (which the JOIN depends on) twice and, I would prefer not to see the selection criteria fields SETS and STATUS because I already know they are 'XYZ' and 'A' for all rows.

Just dont include the columns you do not want to see. If you do * it will bring everything.

SELECT T1.TAPE, T1.SLOT, T2 .DATETIME
 FROM TABLE1 AS T1
 LEFT JOIN TABLE2 AS T2 
   ON T2.TAPE = T1.TAPE 
WHERE T2.SETS='XYZ' 
   AND T2.STATUS='A';
1 Like

Beautiful! You simplified and normalized the statement!