Can this be done with a query?

I have two tables (receptacles, power_trails)


I’m trying to figure out a query that would only result i the receptacle_id of any recepacle_id NOT in the power_trails table?

My thinking is I only want to see the receptacles without a power trail (meaning they are available)

SELECT whatever
  FROM receptacles
 WHERE NOT EXISTS
       ( SELECT 'whoops'
           FROM powertrails
          WHERE receptacle_id = receptacles.receptacle_id )
1 Like

thnnks

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.