3
I’m trying to make the conversion of a select from sql server to Dapper, as it was very big, I’m wanting to leave more lean and readable... However this appearing error in some passages
SELECT
email.assunto [Assunto],
disp.cod_disparador [DisparadorID],
p.Desc_Pessoa [DescricaoPessoa],
ee.cod_Email_Auto_Config_Disparador_Email_Empresa [EmailDisparadorConfigID]
FROM
CL2_Empresa emp,
CL2_Email_Auto_Config_Disparador_Email email,
CL2_Email_Auto_Config_Disparador disp,
CL2_Pessoa p,
CL2_Email_Auto_Config_Disparador_Email_Empresa ee
INNER JOIN CL2_Email_Auto_Config_Disparador_Email_Empresa
ON CL2_Empresa.Cod_Empresa = ee.Cod_Empresa
INNER JOIN CL2_Pessoa
ON CL2_Empresa.Cod_Pessoa = CL2_Pessoa.Cod_Pessoa
RIGHT OUTER JOIN CL2_Email_Auto_Config_Disparador
INNER JOIN CL2_Email_Auto_Config_Disparador_Email
ON CL2_Email_Auto_Config_Disparador.cod_disparador = CL2_Email_Auto_Config_Disparador_Email.cod_disparador
ON ee.cod_disparador_email = CL2_Email_Auto_Config_Disparador_Email.cod_disparador_email
WHERE
(disp.cod_disparador = 2)
But in these two lines, the error message appears:
(the mult-part Identifier "field name" could not be bound)
CL2_Email_Auto_Config_Disparador_Email_Empresa ON CL2_Empresa.Cod_Empresa = ee.Cod_Empresa INNER JOIN CL2_Pessoa ON CL2_Empresa.Cod_Pessoa = CL2_Pessoa.Cod_Pessoa RIGHT OUTER JOIN
You have a
inner join
to a table that has already been listed. then it is lost in which to use, alias or without.– Guilherme Lautert
your select ta very messy, you start one way and then start using Inner Join.. user one thing or another.
– Marco Souza
@Gokussjgod, really... I changed the select and it brought me the same fields and it became even cleaner visibly... :)
– Mfilho_19
already corrected, you can post as corrected or delete the question.
– Marco Souza
SELECT email.subject [Subject], Disp.cod_trigger [Disparadorid], p.Desc_person [Descricaopessof], ee.cod_Email_Auto_Config_Disparador_Email_Empresa [Emaildisparadorconfigid] FROM Cl2_email_auto_config_triggeror_email, Cl2_email_auto_config_trigger Disp, Cl2_person p, Cl2_email_auto_config_trigger_email_company ee WHERE (Disp.cod_trigger = 2) Only left without formatting hehehe Thanks @Guilhermelautert and @Gokussjgod!!!
– Mfilho_19
@Mfilho_19 does not post as a comment, post as a reply and accept it.
– Genos
@Genos I don’t understand, I could explain better?
– Mfilho_19
@Mfilho_19 Instead of posting the solution as a comment, use the button below (I believe for the owner of the question to be something like 'Answer my question') to post the solution as an official answer. Then accept that answer.
– Genos