How to re-write the query

  • Hi All,

    Can someone help me to re-write this query to use one single coordinators table.

    SELECT *

    FROM personnel

    WHERE Office IN ( SELECT Office_code

    FROM coordinators

    WHERE employee IN (

    SELECT employee ID

    FROM coordinators)

    )

    EO

  • SELECT

    p.*

    FROM

    personnel p inner join

    coordinators c on p.Office=c.Office_code

    As you are seeking an employee of the coordinators table between all employees in the coordinators table, the second IN clause is not needed at all.

  • :-)SELECT P.*

    FROM personnel P inner join coordinators C on

    p.Office=c.Office_code

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply