Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:29:43+00:00 2026-06-15T15:29:43+00:00

The code I have for this is select name from employee e, workon w

  • 0

The code I have for this is

select name
from employee e, workon w
where e.empid = w.empid
and pid in
   (select pid 
    from workon
    where did in
         (select did
          from employee ee
          where e.did = ee.did))
group by name

But I know that isn’t right, since I also need to find someone who works in a project outside of his division. The problem is that I’m not too sure how to do that.

Tables
Employee

EMPID   NAME    SALARY  DID
1   kevin   32000   2
2   joan    46200   1
3   brian   37000   3
4   larry   82000   5
5   harry   92000   4
6   peter   45000   2
7   peter   68000   3
8   smith   39000   4
9   chen    71000   1
10  kim 46000   5
11  smith   46000   1

Workon

PID EMPID   HOURS
3   1   30
2   3   40
5   4   30
6   6   60
4   3   70
2   4   45
5   3   90
3   3   100
6   8   30
4   4   30
5   8   30
6   7   30
6   9   40
5   9   50
4   6   45
2   7   30
2   8   30
2   9   30
1   9   30
1   8   30
1   7   30
1   5   30
1   6   30
2   6   30
Project 

PID PNAME   BUDGET  DID
1   DB development  8000    2
2   network development 6000    2
3   Web development 5000    3
4   Wireless development    5000    1
5   security system 6000    4
6   system development  7000    1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:29:44+00:00Added an answer on June 15, 2026 at 3:29 pm
    select e.name
    from employee e
    where
        -- Projects in department
        exists (
            select *
            from 
                workon w
                join project p
                    on w.pid = p.pid
                    and p.did = e.did
            where w.empid = e.empid
        )
        -- Projects out of department
        and exists (
            select *
            from 
                workon w
                join project p
                    on w.pid = p.pid
                    and p.did != e.did
            where w.empid = e.empid
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: con.Open(); cmd = new MySqlCommand(String.Format(SELECT concat(name,'|',lastname) FROM {0} WHERE ID=
i have this code right here: <select name=group> <option value=>Choose a group....</option> <?php foreach($groups
I have this code here printf '$request1 = select * from whatever where this
I have this code (an example that PHP generates for me)... <select id=outsideBlue3> <option
I have a query SELECT d.name, count(e.id) FROM department d LEFT OUTER JOIN employee
I have this code for a select box which is being displayed by the
I have this code <Select> <option value=-1>Select</option> <option value=6>kasper </option> <option value=13>adad </option> <option
i have this code : IEnumerable<string> q = customers /*EF entity*/ .Select (c =>
Okay so i have this code: if (isset($_GET['book'])) { $query= SELECT book_id, title, authors.`author`
I have a table generated from some PHP code that lists a SMALL amount

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.