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', '...
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...
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...
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?
...
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...