nested-query

Nested LINQ query using Contains with a bigint

This is the SQL I want (ClearinghouseKey is a bigint): select * from ConsOutput O where O.ClearinghouseKey IN ( select distinct P.clearinghouseKey from Project P Inner join LandUseInProject L on L.ClearinghouseKey = P.ClearinghouseKey where P.ProjectLocationKey IN ('L101', 'L102', 'L103') and L.LandUseKey IN ('U000', 'U001', '...

How to avoid nested SQL query in this case?

I have an SQL question, related to this and this question (but different). Basically I want to know how I can avoid a nested query. Let's say I have a huge table of jobs (jobs) executed by a company in their history. These jobs are characterized by year, month, location and the code belonging to the tool used for the job. Additionally I...

SQL: Help with a nested queries

Here is my schema: Suppliers(sid: integer, sname: string, address string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) bold indicates primary key. I want to write a query to find all suppliers who supply every part. Here are two queries I have already: -- get all parts for a giv...

same table, 1 field to 2 field query

I have 2 tables: 1st holds employees (of ones in any position) and the 2nd holds manager employee relations with id numbers. I want to write a query like 1st field: name(employee), 2nd field: name(manager) How can I do that? ...

Show names of suppliers who delivered largest delivery (nested query)?

I have a table S containing suppliers (S, SNAME, CITY), a table P containing products (P, PNAME, COLOUR, WEIGHT, PRICE) and a table SP containing deliveries (S, P, QTY) where S and P are foreign keys to table S and P. What I have been asked to do is "Show the name of the supplier(s) who have delivered the largest delivery (as a nest...