title: sql: join and view
body: <p>I do i use join between multiple tables to expose a view</p>
  
  <p>I have a main table that represents a list of hotels </p>
  
  <pre><code>Hotels( id_hotel, name,address, website)
  </code></pre>
  
  <p>Then I have another table that represents the coordinates of the hotel</p>
  
  <pre><code>hotel_coordinates(id_hotel,latitude,longidute)
  </code></pre>
  
  <p>And at the other end of a table that represents the picture associated with the hotel :</p>
  
  <pre><code>hotel_images(hotel_id,image)
  </code></pre>
  
  <p>The first table contains as many records as are hotels , that is, if there are 100 hotels in the table has 100 records</p>
  
  <p>The second table contains a variable number of records , this number depends on the user for which he entered the coordinates of the hotel, for example may have 50 records . Each record is uniquely identified by id_hotel</p>
  
  <p>The third table instead, as the second table can have a variable number of records as a function of the photos have been uploaded , otherwise this table for each id_hotel can have a number of records as a function of the photo , that is, for example, </p>
  
  <p>the first hotel has 2 photos that have been uploaded will these 2 records :</p>
  
  <pre><code>     id_hotel  imageSize 1    imageSize2      imageSize3
        1        image1.jpeg     null            null
        1        image2          image3.jpeg     null
  </code></pre>
  
  <p>I would like to create a view that must have 100 records because 100 is the number of the hotel, then every field must be set opportunely (eg: if there is image1 then it must be appreciated , but if there is foto_1 the field must be set to null) . The columns of the view would be:</p>
  
  <p>id_hotel; name; address; website; latitude; longitude; fhoto_1; fhoto_2; fhoto_3;</p>
  
  <p>How can I use a join to have a view that shows 100 records? And set to null or valued the latitude longitude fhoto_1 fhoto_2 fhoto_3?</p>