SQLTeam.com | Weblogs | Forums

Inner Join

SELECT a.type, a.name, a.name_factory, a.document, a.rg, a.profession a.email, a.phone, a.phone2, a.profile, a.address, a.townhouse, a.status , b.name AS professionName , c.name AS profileName FROM id_clients a INNER JOIN id_config_profession b ON a.profession = b.cod INNER JOIN id_config_client_profile c ON a.profile = c.cod WHERE a.cod = '46' LIMIT 1

this query has 2 inner joins and it is works. for example, over there professionName and profileName, it will compare with table A and will bring the name of tables B and C.if the codes in table A exist, this works normally. however, the problem is that these fields are not mandatory, some records have these fields empty. but this query is always there and when it finds a record that does not have the codes in table A, it will not be able to associate the inner joins and there will fail the query.

Is there any way to resolve this?
(i dont speak english very well, sorry).

please see the following link if it helps

1 Like