I am trying to use a second SELECT to get some ID, then use that ID in a second SELECT and I have no idea how.

SELECT Employee.Name 
FROM Emplyee, Employment 
WHERE x = Employment.DistributionID 
(SELECT Distribution.DistributionID FROM Distribution 
       WHERE Distribution.Location = 'California') AS x

This post got long, but here is a short "tip"

While the syntax of my select is bad, the logic is not. I need that "x" somehow. Thus the second select is the most important. Then I have to use that "x" within the first select. I just don't know how

/Tip

This is the only thing I could imagine, I'm very new at Sql, I think I need a book before practicing, but now that I've started I'd like to finish my small program.

EDIT:

Ok I looked up joins, still don't get it

SELECT Employee.Name 
    FROM Emplyee, Employment 
    WHERE x = Employment.DistributionID 
    LEFT JOIN Distribution ON
    (SELECT Distribution.DistributionID FROM Distribution 
           WHERE Distribution.Location = 'California') AS x

Get error msg at AS and Left

I use name to find ID from upper red, I use the ID I find FROM upper red in lower table. Then I match the ID I find with Green. I use Green ID to find corresponding Name

enter image description here

I have California as output data from C#. I want to use California to find the DistributionID. I use the DistributionID to find the EmployeeID. I use EmployeeID to find Name

My logic:

Parameter: Distribution.Name (from C#)

Find DistributionID that has Distribution.Name
Look in Employment WHERE given DistributionID 
      reveals Employees that I am looking for (BY ID)
Use that ID to find Name
      return Name

Tables:

NOTE: In this example picture the Employee repeats because of the select, they are in fact singular

In "Locatie" (middle table) is Location, I get location (again) from C#, I use California as an example. I need to find the ID first and foremost!

enter image description here

Sory they are not in english, but here are the create tables:

enter image description here

I don't know how you are connecting Emplyee(sic?) and Employment, but you want to use a join to connect two tables and in the join specify how the tables are related. Joins usually look best when they have aliases so you don't have to repeat the entire table name. The following query will get you all the information from both Employment and Distribution tables where the distribution location is equal to california. You can join employee to employment to get name as well.

SELECT *
FROM Employment e
JOIN Distribution d on d.DistributionID = e.DistributionID
WHERE d.Location = 'California'

This will return the contents of both tables. To select particular records use the alias.[Col_Name] separated by a comma in the select statement, like d.DistributionID to return the DistributionID from the Distribution Table