Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/11/2011, 23:23
Avatar de cristian_qc
cristian_qc
 
Fecha de Ingreso: abril-2011
Mensajes: 43
Antigüedad: 13 años
Puntos: 8
Respuesta: duda sobre sentencia

Cita:
hoteles
Valores de la tabla hb_hoteles que el campo tipo_alojamiento sea HTL
Código MySQL:
Ver original
  1.    hotel.id
  2. from hb_hoteles as hotel
  3. inner join hb_hoteles_tipo as tipo on tipo.id = hotel.tipo_alojamiento
  4. where tipo.tipo_alojamiento = 'HTL';
Como consejo: los valores de las claves foraneas deberian denotar que son claves foraneas, entonces no pongas "tipo_alojamiento" en la tabla "hb_hoteles" sino algo como "idtipoalojamiento" sabiendo que solo es el ID y no el tipo.