Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2015

    Unanswered: How to write a corelated subquery for the below one?

    Can anyone help me to write co-related subquery for the below non-corelated subquery?

    SELECT e.emp_no,e.last_name FROM employees e,dept_emp d
    WHERE e.emp_no = d.emp_no
    AND d.dept_no = (SEELCT dept_no FROM dept_emp WHERE emp_no =
    (SELECT emp_no FROM employees WHERE first_name = "Margareta" AND last_name = "Markovitch"));

    Thank you.

  2. #2
    Join Date
    Sep 2007
    Bangalore India
    Can you tell which type of result you expecting, so you run your query.

  3. #3
    Join Date
    Jul 2015
    What benaya said. Also, it will speed up the query if you use in rather than =, so change this

    d.dept_no = (SELECT dept

    to this

    d.dept_no in (SELECT dept

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts