Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Martin Vajsar wrote:Other possibilities might be:
Martin Vajsar wrote:Doh! Of course, I forgot to relate the subquery records to the main query records.
This one should work:
Thanks for pointing that out, Palak!
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Martin Vajsar wrote:First query queries for dep2 department, not dep1 - the results differ.
Second query is my original (ie. wrong) query, does not even compile because of exist instead of exists.
Try this (should work with your input data):
These three queries produce identical (albeit differently ordered, see always use ORDER BY) output.
Palak Mathur wrote:
Martin Vajsar wrote:Try this (should work with your input data):
Using your data. ...
Akhilesh Trivedi wrote:There is separate "emp" and "dept" master tables for employees and department respectively. But would we need them?
Martin Vajsar wrote:
Akhilesh Trivedi wrote:There is separate "emp" and "dept" master tables for employees and department respectively. But would we need them?
I assume the association table contains surrogate keys/IDs of the emp and dept table; if you want to use values from emp/dept table directly in the query, you need to join them.
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Akhilesh Trivedi wrote:
Martin Vajsar wrote:
Akhilesh Trivedi wrote:There is separate "emp" and "dept" master tables for employees and department respectively. But would we need them?
I assume the association table contains surrogate keys/IDs of the emp and dept table; if you want to use values from emp/dept table directly in the query, you need to join them.
Not required Martin. Your first out of the three queries worked here. Thanks!
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]