I have a table "messages"
['id', 'en', 'type', 'company_id']
i have two types
['new_contract', 'new_offer']
i may have two records with the same 'type' = 'type' but one with a company_id and one with a null 'company_id'
i want to select all records with company_id =1 but if one type is missing for this company get the missing type record even if it's null company_id
 record 1 ['1', 'new contract', 'new_contract','1']
 record 2 ['2', 'new offer', 'new_offer','2']
 record 3 ['3', 'new offer', 'new_offer',NULL]
 record 4 ['4', 'new contract', 'new_contract',NULL]
 Output
 record 1 ['1', 'new contract', 'new_contract', '1']
 record 3 ['3', 'new offer', 'new_offer', NULL]
Not sure if that's possible using sql your text
 
     
     
     
    