title: Writing sql queries from multiple tables
body: <p>I could use some help writing a SQL query. I'm trying to display some data from one table but the data I need depends on a value from a different table. I'm pretty new to this so I will try to explain this the best I can:</p>
  
  <p>I have an <code>Orders</code> table with a <code>ShipCity</code> and <code>OrderId</code> columns. I would like to get the <code>OrderId</code> value from <code>Orders</code> where <code>ShipCity</code> = <code>Caracas</code>. using those distinct <code>OrderId</code> values, I would like to query a different table called <code>Order Details</code> where [Order Details].[OrderId] = [Orders].[OrderId] (= to 'Caracas').</p>
  
  <p>I hope that made sense. where I'm getting stuck is I'm sure that I will either need to create some variables or a temporary table to store these values and I don't have any experience with these things yet. I'd appreciate any help. also, these are tables in the Northwind sample database if that helps. below is a dummy sample of what I'm trying to do.</p>
  
  <pre><code>Select OrderId
  FROM [Orders]
  WHERE ShipCity = 'Caracas'
  
  Select OrderId
  FROM [Order Details]
  WHERE OrderId = (Orders.ShipCity = 'Caracas')
  </code></pre>
  
  <p>here's another way of looking at it:</p>
  
  <pre><code>SELECT OrderId
  FROM [Order Details]
  WHERE OrderId = [Orders].ShipCity = 'Caracas'
  </code></pre>