Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2015
    Posts
    1

    Unanswered: Query with null values

    Hi

    I have a query with inner join, this one

    Code:
    SELECT 
    COALESCE(id_tempo, 0) AS id_tempos
    ,`semana_dias`.`dia`
    , `req_material_sala`.`sala`
    , `req_material_tempo`.`inicio`
    FROM sala_ocupacao 
    INNER JOIN `semana_dias` ON (`sala_ocupacao`.`id_dia` = `semana_dias`.`id_dia`)
    INNER JOIN `req_material_sala` ON (`sala_ocupacao`.`id_sala` = `req_material_sala`.`idsala`)
    INNER JOIN `req_material_tempo` ON (`sala_ocupacao`.`id_tempo` = req_material_tempo.`idtempo`)
    ORDER BY id_ocup;
    The values with nulls are not showed
    If i remove those lines

    Code:
    , `req_material_tempo`.`inicio`
    INNER JOIN `req_material_tempo` ON (`sala_ocupacao`.`id_tempo` = req_material_tempo.`idtempo`)
    I get all vailues but i need that column because is the one who gonna give the names and not the id.

    Any help please?

    Thank you

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Use left join instead of inner join if the are null values in the right hand table in the join http://stackoverflow.com/questions/5...-and-full-join
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •